Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - PtCombobox focus problem: (5 Items)
   
PtCombobox focus problem  
I am giving focus to a combobox widget using PtGlobalFocusNext() or PtGlobalFocusPrev(). After giving focus i am 
retreiving the integer value of the combobox widget using ApName(), but the integer value of combobox widget defined in 
abvars.h file is different from what i get using ApName(). 
Pls suggest how can i get the same integer value for combobox widget.
Re: PtCombobox focus problem  
Could you please post a small sample app that shows your problem?
Re: PtCombobox focus problem  
PtWidget_t *CurrentWidget;
//the next focusable widget to ABW_PtLabelName is ABW_CboName 
CurrentWidget = PtGlobalFocusNext(ABW_PtLabelName,NULL);
printf("%d,ApName(CurrentWidget));

Here the o/p of printf is different from that of ABN_CboName.
for eg. ABN_CboName = 127, the o/p of ApName(CurrentWidget) = 1283466
Re: PtCombobox focus problem  
This is expected. PtComboBox is a compound widget -- it contains subordinate widgets: PtText, PtList and other 
(transient) widgets. Focus is given to the PtText, which doesn't have an ABN number associated with it. Subordinate 
widgets of compound widgets are PROCREATED, so add this code after the focus change:

 if( PtWidgetFlags(CurrentWidget) & Pt_PROCREATED ) {
     CurrentWidget = PtWidgetParent( CurrentWidget );
 }

You should get a correct ABN number now.
Re: PtCombobox focus problem  
Thanks Misha
Now code is working fine.