Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » OnTabWndSelectionChange() called twice and subclassing Collapse All
Subject Author Date
rajneesh May 2, 2003 - 6:35 AM

Hi,
I am using your Professional User Interface SDK in my application. I have written a class derived from Profuis CExtTabWnd class to create tab wnd control. I need to perform some lengthy operation when the user changes the tab selection. For this i have overwritten OnTabWndSelectionChange() virtual function, but i found that this method is called twice for a single selection, which i can’t afford as my processs takes a long time. I have also tried this with OnTabWndClickedItem() virtual function but the same thing happens. Suggest some remedy for this.

Also i wan’t to know if i can subclass my existing controls with Profuis classes.

Customer Support Team May 3, 2003 - 8:44 AM

Dear Rajneesh,

Yes, you are right. Those functions are really called twice. Please take a look at their declarations:

virtual bool OnTabWndClickedItem( LONG nItemIndex, bool bButtonPressed, INT nMouseButton,UINT nMouseEventFlags );
virtual bool OnTabWndSelectionChange( LONG nOldItemIndex, LONG nNewItemIndex, bool bPreSelectionTest );

When calling OnTabWndClickedItem for the first time, bButtonPressed is set to true and, if the function returns false, it will not be called for a second time. When it is called for a second time, bButtonPressed is false. This is similar to the OnLButtonDown/OnLButtonUp behavior.

When calling OnTabWndSelectionChange for the first time, bPreSelectionTest is set to true too. In case the returned value is false, the second call of OnTabWndSelectionChange will not be done. This allows you to disable selection of some items when you need it.

I think you should start performing your lengthy operation when OnTabWndSelectionChange is being called for a second time (with bPreSelectionTest = false). In this case, the long time operation will be started just after the tab item is repainted to a selected state.