Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When embed fires when the user clicks on a tab control? 2

Status
Not open for further replies.

rleiman

Programmer
May 3, 2006
258
US
Hi Everyone.

Can you tell me what embed point to place my code when the user clicks or selects on a tab control?

I tried %ControlHandling: (?tab:NameAndAddress) and put a message box in there to see if the code was firing, but the message box doesn't get displayed.

Thanks in advance.

Emad
 
Hi Emad,

Sheet Control - EVENT:NewSelection

By default the Sheet Control is ?CurrentTab. So on ?CurrentTab - EVENT:NewSelection, you can do either :

CASE CHOICE(?CurrentTab)
OF 1 ! First Tab
OF 2 ! Second Tab
...
END

OR

CASE ?CurrentTab{PROP:ChoiceFeq}
OF ?Tab:1 ! First Tab Label
OF ?Tab:2 ! Second Tab Label
...
END

Regards

 
Hi ShankarJ,

Thanks for the code.

I will implement it. I like the one with the ? mark since it will allow me to make the code more readable.

Truly,

Emad-ud-deen Richard Leiman
 
When you receive EVENT:TabChanging the OLD tab show as the selection. If you are interested in the NEWLY selected tab, then I recommend posting an event

I use my own equate:
POST(Event:User:TabChanged)

Then place your code to handle the NEWLY selected tab under Event:User:TabChanged

HTH,
Mark Goldberg
 
Hi Mark,

Thanks for the post. For now I am using ShankarJ's CASE ?CurrentTab{PROP:ChoiceFeq} logic, but would like to know more about setting up user events.

In POST(Event:User:TabChanged) does any part of this post function need to be defined anywhere in my program before issuing it?

Thanks.

Truly,
Emad

 
The answer is no (and yes) <G>

There is no need for any extra code to POST an event, or to receive the event. In other words, there is NO need for anything like the API RegisterWindowMessage. How you react to receiving the event is up to you.

You can use POST(Event:User + nnn) where n is an integer between 0 and 3071 (see EVENT:USER and EVENT:LAST)

I suggest you create an EQUATE to improve the readability of your code, and to reduce the likely hood of your using the same event number for two different meanings. Additionally if you discover that the events are being used by other code (such as 3rd party products) then it's a simple matter of altering the ONE equate, vs. searching all of your code to alter the the +N portion.


I use:
User:TabChanged EQUATE(EVENT:APP + 100)
User:CancelTabChange EQUATE(EVENT:APP + 101)

As you may have noticed, instead of EVENT:USER I am using EVENT:APP.

EVENT:USER appears in %cwroot%\libsrc\equates.clw however EVENT:APP is NOT defined for you.

Event:APP EQUATE(08000h)
Event:APP_LAST EQUATE(0BFFFh)


The following link was pointed years ago in the newsgroups by Carl Barnes. The link will tell that some of the event numbers between EVENT:USER and EVENT:LAST are being used by Microsoft. The upshot is that we should be using EVENT:APP instead of EVENT:USER

!
HTH,
Mark Goldberg
 
Hi Mark,

The post was very helpful. Thank you.

Truly,
Emad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top