The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

theartfuldodger (23) [Avatar] Offline
#1
I am unable to get this to work. Registered the quicktip but doesn't display.

Ext.QuickTips.register({
target: 'principal',
title: 'My Tooltip',
text: 'This tooltip was added in code',
width: 100,
dismissDelay: 20
});

'principal' is the id associated with the checkbox.

Ext.QuickTips.init(); is first thing executed in script.
jesus.garcia (463) [Avatar] Offline
#2
Re: Quicktips for Checkboxes?
is the quicktip registered before the checkbox is rendered?
theartfuldodger (23) [Avatar] Offline
#3
Re: Quicktips for Checkboxes?
yes, it's registered at the top of the script right below the Ext.QuickTips.init();
jesus.garcia (463) [Avatar] Offline
#4
Re: Quicktips for Checkboxes?
that's your problem. You should register it after the checkbox is rendered. Else the quick tip doesn't have a target to attach to.
theartfuldodger (23) [Avatar] Offline
#5
Re: Quicktips for Checkboxes?
ok, i placed the registration code at the end of the script, but it still doesn't work.

I am referencing the id of the checkbox as the target. Is there anything else I need to place in the checkbox or form definition to sync it up?
jesus.garcia (463) [Avatar] Offline
#6
Re: Quicktips for Checkboxes?
your delay is 20ms, which is why it may not be appearing quick enough for you to register it.

The following works fine for me:

Ext.QuickTips.init();
new Ext.Window({
items : {
xtype : "checkbox",
id : 'mycheckbox'
}
}).show();

Ext.QuickTips.register({
target: 'mycheckbox',
title: 'My Tooltip',
text: 'This tooltip was added in code',
width: 100,
dismissDelay: 2000
});
theartfuldodger (23) [Avatar] Offline
#7
Re: Quicktips for Checkboxes?
Still doesn't work.

I suspect the problem may be in the way I am defining the form. I am using an xtype instead of an Ext.form.Panel constructor (and then adding it to a viewport region):

var switchForm = {
id : 'switchform',
xtype : 'form',
title : 'Switch Settings',
buttonAlign : 'center',
frame : true,
labelAlign : 'right',
defaultType : 'checkbox',
padding : 10,
defaults : {
padding : 10
},
items : [
{
name : 'Principal',
id : 'principal',
boxLabel : "Apply payments to principal and interest",
inputValue : true,
},
{
name : 'Oldest',
boxLabel : "Apply payments to the oldest amount due",
inputValue : true,
checked : true
jesus.garcia (463) [Avatar] Offline
#8
Re: Quicktips for Checkboxes?
you can save youself time by registering an 'afterrender' listener to the checkbox, which will pass itself to the handler. You can use that argument to register the quick tip. Ideally, you should destroy/deregister the quick tip when that component is destroyed.
jesus.garcia (463) [Avatar] Offline
#9
Re: Quicktips for Checkboxes?
FWIW, even if you use the constructor, the item still is not rendered until after its render phase has completed. (Chapter 3)