| View previous topic :: View next topic |
| Author |
Message |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Mon Aug 18, 2003 4:47 pm Post subject: Generate TAB CLICK event and other TAB stuff |
|
|
What I want to do in my program is check the OS version and have the proper tab selected based on the version. If I just goto the specific tab label but the tab itself isn't selected. I have searched the forum but couldn't find anything...
Also, how would one disable specific tabs? I'm guessing API would have to be used... _________________ "ah, come take my hand... we're ridin' out tonight to face the promised land"
Get a free iPod mp3 player... |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Aug 18, 2003 9:03 pm Post subject: |
|
|
You use DIALOG SET with the name of the tab element, and then the
text of the tab that you wish to be the active tab.
-Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Tue Aug 19, 2003 7:09 pm Post subject: |
|
|
| Garrett wrote: | You use DIALOG SET with the name of the tab element, and then the
text of the tab that you wish to be the active tab.
-Garrett |
Thanks Garret! That works to select the tab... but it doesn't generate the CLICK event. Odd but no big deal since I can simulate the event. Now, is there a way to disable specific tabs? _________________ "ah, come take my hand... we're ridin' out tonight to face the promised land"
Get a free iPod mp3 player... |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Tue Aug 19, 2003 8:57 pm Post subject: |
|
|
Not sure how to disable a specific tab, maybe an API for that is around,
but I don't know of it myself.
Yeah, sorry, I should have mentioned that no click event was kicked
when you did that.
-Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Tue Aug 19, 2003 10:14 pm Post subject: |
|
|
I don't think you can disable a specific tab on a tab element. I haven't
ever seen it done, and if you use an API to disable it, it will disable the
whole tab control. But an alternative would be to check and when it's
clicked on just send the user back to the tab he/she was on.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Wed Aug 20, 2003 6:34 pm Post subject: |
|
|
That's what I ended up doing after all... thanks for your help!  _________________ "ah, come take my hand... we're ridin' out tonight to face the promised land"
Get a free iPod mp3 player... |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Aug 21, 2003 9:36 am Post subject: |
|
|
You cannot disable a tab item.
Want to remove a tab Item ?
Use this :
%A = @SENDMSG(~TAB1,@SUM($1300,8 ),1,0)
Please note :
Tab Item numbering is zero based.
So "1" in above statement removes the second tab item and so on.
To insert back the tab Item :
%S =@BINARY(WORD,$1)@BINARY(WORD,0)@BINARY(WORD,0)@BINARY(STR,Tab 2)@BINARY(WORD,0)@BINARY(WORD,-1)@BINARY(WORD,0)
%A = @SENDMSG(~TAB1,@SUM($1300,7),1,@ADDR("%S"))
BUT NOTE THAT I THINK THIS IS NOT POSSIBLE IN VDS AS OF NOW.
You don't have STR type for @BINARY(STR,Tab 2) that can be defined in
a structure.
If desperate you need (to write) a dll OR WAIT FOR MY WORKAROUND !
This is IMHO. I may be wrong.
EDIT :
There are ways to hide the left most 1 or more tab items and again show it if you want. Also you can set a tab item to focus, Get to know which tab is currently focssed/selected and set tab bitmaps (Bit tabs) with transparent styles !! All this is possible in VDS 5 with API. I am waiting for my VDS license to make a Unit. Please Wait
Regards _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Aug 21, 2003 3:59 pm Post subject: |
|
|
| CodeScript wrote: | To insert back the tab Item :
%S =@BINARY(WORD,$1)@BINARY(WORD,0)@BINARY(WORD,0)@BINARY(STR,Tab 2)@BINARY(WORD,0)@BINARY(WORD,-1)@BINARY(WORD,0)
%A = @SENDMSG(~TAB1,@SUM($1300,7),1,@ADDR("%S"))
BUT NOTE THAT I THINK THIS IS NOT POSSIBLE IN VDS AS OF NOW.
You don't have STR type for @BINARY(STR,Tab 2) that can be defined in
a structure.
If desperate you need (to write) a dll OR WAIT FOR MY WORKAROUND !
This is IMHO. I may be wrong.
|
A string is just an array of bytes but in the case of these API messages CodeScript your structure is a little off... Take a look below for the correct definition of the structure and how to apply it...
| Code: | WAIT 5
%A = @SENDMSG(@Winexists(~TAB1),@SUM($1300,8),0,0)
WAIT 5
%T = Shortcuts
%S = @BINARY(DWORD,1)@BINARY(DWORD,0)@BINARY(DWORD,0)@BINARY(DWORD,@addr("%T"))@BINARY(DWORD,@Sum(@len(%T),0))@BINARY(DWORD,-1)@BINARY(DWORD,0)
%A = @SENDMSG(@Winexists(~TAB1),@SUM($1300,7),0,@ADDR("%S"))
WAIT 5
|
Note that an UINT is actually a DWORD variable type VB is very forgiving when it comes to defining variables so please cross check the variable types with either C/C++ header files or Delphi... Also note that when a structure's member variable has the letters LP or P prepended to the name it is refering to a pointer not the value of...so it would be in VB BYREF and not BYVAL or in C/C++ char *, LPSTR, or LPTSTR and not char mystring[256];....
Now to answer the question...You want to have the tab control generate a click event when you switch to a different tab programmaticly. Well to do this you would do like Garrett said above but right after that you will have to send the dialog a TCN_SELCHANGE notification message with the ID of the tab and the handle of the Tab control. The only problem that I can see with this is the fact that you have to send the ID in the low word of the WPARAM... So to do this we will explore how to place a value in the low word with out placing anything in the high word...
| Code: | %%lo = @BINARY(WORD,32)
%%high = @BINARY(WORD,0)
%D = %%lo%%high
Info Value of D = @Val(%D)
# Now %D should have %%lo and high in a DWORD value
Info Lowword = @Val(@SubStr(%D,1,2))@CR()Highword = @Val(@SubStr(%D,3,4))
Info Lowword = @Gadget(loword,@Val(%D))@CR()Highword = @Gadget(hiword,@Val(%D))
|
If I have time latter I will give you an example of sending the TCN_SELCHANGE notification API message to your dialog...But you should now have enough info to do it yourself
I had the low and high backwards...I forget sometimes...I updated the code and I have gadget code to validate it above
Of course this is not that great of an example for seperating a DWORD into it's high and low parts but if you replace it with this code you can get a better feel for this...
| Code: | %%lo = @BINARY(WORD,32)
%%high = @BINARY(WORD,25)
%D = %%lo%%high
Info Value of D = @Val(%D)
# Now %D should have %%lo and high in a DWORD value
Info Lowword = @Val(@SubStr(%D,1,2))@CR()Highword = @Val(@SubStr(%D,3,4))
Info Lowword = @Gadget(loword,@Val(%D))@CR()Highword = @Gadget(hiword,@Val(%D))
|
Just because the high word has a value of something other than 0.... _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Fri Aug 22, 2003 3:51 am Post subject: |
|
|
Thanx mindpower.
I got the mistake I did. I had tried this one with failure.
@Sum(@len(%T),0)) - I somehow missed this ?
Now it works OK.
BTW Mindpower
I don't think TCN_SELCHANGE notification messages are required.
TCM_SETCURSEL to select the required tab is enough. It generates click event also; unlike TCM_SETCURFOCUS/ Dialog Set which donot generate an event.
Regards _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Aug 22, 2003 12:49 pm Post subject: |
|
|
| CodeScript wrote: | Thanx mindpower.
I got the mistake I did. I had tried this one with failure.
@Sum(@len(%T),0)) - I somehow missed this ?
Now it works OK.
BTW Mindpower
I don't think TCN_SELCHANGE notification messages are required.
TCM_SETCURSEL to select the required tab is enough. It generates click event also; unlike TCM_SETCURFOCUS/ Dialog Set which donot generate an event.
Regards |
Unless the API has changed since the Win32.hlp was publish then TCM_SETCURSEL does not forward the TCN_SELCHANGE notification message. See the a snip from the help file below...
| MS Win32.hlp wrote: |
TCM_SETCURSEL
wParam = (WPARAM) (int) iItem; // index of the tab to select
lParam = 0; // not used; must be zero
// Corresponding macro
int TabCtrl_SetCurSel(HWND hwnd, int iItem);
The TCM_SETCURSEL message selects a tab in a tab control. You can send this message explicitly or by using the TabCtrl_SetCurSel macro.
Parameters
iItem
Index of the tab to select.
hwnd
Handle to the tab control.
Return Value
Returns the index of the previously selected tab if successful or - 1 otherwise.
Remarks
A tab control does not send a TCN_SELCHANGING or TCN_SELCHANGE notification message when a tab is selected using this message. |
Now if VDS is checking to see which tab is selected then I can understand how it is sending a CLICK event but why would it send a click event when you send the message and not when you use DIALOG SET to select the tab? Misteries abound  _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Fri Aug 22, 2003 6:32 pm Post subject: |
|
|
Mindpower I know that W32.hlp as well as msdn 2000 have wrote that.
But it does work even in VB (although using it that way in VB is like reinventing wheel).
I don't know if it's one of the MS goof ups/bugs. OR I am mistaken ???
If VDS was checking tab state then as you said DIALOG SET should also generate an event.
What I think most likely is that both VDS is checking the active tab item after recieving every TCM_SETCURSEL message.
Regards _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|