1. [WIN32Lib] programmatically select tab item?

Is there a way to  programmatically select a tab item?  Nothing I tried
worked.

I did find a way to destroy a tab item, by using a sledge hammer:  I
destroyed the tabitem, all other tabitems, and then the tabcontrol itself,
and then re-created the tab control, all the tabitems other than the deleted
one, and everything inside each tab item.  This works, except it crashed
when I delete the FIRST tab item, with a message about an instruction
referencing mem FFFFFFFF, except if I manually select any other tab item
first, then go back to the first tab item & delete it, in which case it
works fine.  So I'm thinking to make a delete first tab item start out by
selecting another tab item, then re-selecting the first before it deletes
it.

Dan Moyer

new topic     » topic index » view message » categorize

2. Re: [WIN32Lib] programmatically select tab item?

According to documentation in Microsoft Control Spy (I recommend that you
download it from the web, it has C source code):
- to delete item use TCM_DELETEITEM
- to select item use TCM_SETCURSEL

That should work because I tried it in Tab.exe from Control Spy and it
worked, both of them.

----- Original Message -----
From: "Dan Moyer" <DANIELMOYER at prodigy.net>
To: "EUforum" <EUforum at topica.com>
Subject: [WIN32Lib] programmatically select tab item?


>
> Is there a way to  programmatically select a tab item?  Nothing I tried
> worked.
>
> I did find a way to destroy a tab item, by using a sledge hammer:  I
> destroyed the tabitem, all other tabitems, and then the tabcontrol itself,
> and then re-created the tab control, all the tabitems other than the
deleted
> one, and everything inside each tab item.  This works, except it crashed
> when I delete the FIRST tab item, with a message about an instruction
> referencing mem FFFFFFFF, except if I manually select any other tab item
> first, then go back to the first tab item & delete it, in which case it
> works fine.  So I'm thinking to make a delete first tab item start out by
> selecting another tab item, then re-selecting the first before it deletes
> it.
>
> Dan Moyer
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: [WIN32Lib] programmatically select tab item?

tone,

I'll try to see what Microsoft Control Spy says, but in the meantime, how
would I use
TCM_DELETEITEM & TCM_SETCURSEL
in a program using Win32Lib?

Dan

----- Original Message -----
From: <tone.skoda at siol.net>
To: "EUforum" <EUforum at topica.com>
Subject: Re: [WIN32Lib] programmatically select tab item?


>
> According to documentation in Microsoft Control Spy (I recommend that you
> download it from the web, it has C source code):
> - to delete item use TCM_DELETEITEM
> - to select item use TCM_SETCURSEL
>
> That should work because I tried it in Tab.exe from Control Spy and it
> worked, both of them.
>
> ----- Original Message -----
> From: "Dan Moyer" <DANIELMOYER at prodigy.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Friday, March 22, 2002 2:49 PM
> Subject: [WIN32Lib] programmatically select tab item?
>
>
> > Is there a way to  programmatically select a tab item?  Nothing I tried
> > worked.
> >
> > I did find a way to destroy a tab item, by using a sledge hammer:  I
> > destroyed the tabitem, all other tabitems, and then the tabcontrol
itself,
> > and then re-created the tab control, all the tabitems other than the
> deleted
> > one, and everything inside each tab item.  This works, except it crashed
> > when I delete the FIRST tab item, with a message about an instruction
> > referencing mem FFFFFFFF, except if I manually select any other tab item
> > first, then go back to the first tab item & delete it, in which case it
> > works fine.  So I'm thinking to make a delete first tab item start out
by
> > selecting another tab item, then re-selecting the first before it
deletes
> > it.
> >
> > Dan Moyer
> >

new topic     » goto parent     » topic index » view message » categorize

4. Re: [WIN32Lib] programmatically select tab item?

Dan Moyer wrote:
> how would I use
> TCM_DELETEITEM & TCM_SETCURSEL
> in a program using Win32Lib?

It's pretty simple, below is example. There may be some issues with Win32Lib
because it's not expecting that you do this.
To Derek: These actions should become possible to do this with Win32Lib's
functions
deleteItem () and selectItem () (this one doesn't exist yet)

Syntax:

Void = sendMessage (tabControl window, message (action), index of tab item
to delete starting at 0, 0)

-- select and delete tab items.exw

without warning
with trace
include win32lib.ew

integer win, tc, t1, t2, t3, t4
integer te1, te2, te3, te4
integer g1, g2, g3, g4
object Void

procedure main()
    win = createEx(Window, "Test Tabcontrol", 0, 0, 0, 640, 480, 0, 0)
    tc  = createEx(TabControl, "", win, 5, 25, 600, 400, 0, 0)
    t1 = createEx(TabItem, "One",   tc, 5, 25, 590, 390, 0, 0)
    t2 = createEx(TabItem, "Two",   tc, 5, 25, 590, 390, 0, 0)
    t3 = createEx(TabItem, "Three", tc, 5, 25, 590, 390, 0, 0)
    t4 = createEx(TabItem, "Four",  tc, 5, 25, 590, 390, 0, 0)

    g1 = createEx(Group, " group 1", t1, 5, 25, 400, 300, 0, 0)
    g2 = createEx(Group, " group 2", t2, 5, 25, 400, 300, 0, 0)
    g3 = createEx(Group, " group 3", t3, 5, 25, 400, 300, 0, 0)
    g4 = createEx(Group, " group 4", t4, 5, 25, 400, 300, 0, 0)

    te1 = createEx(Combo, "control1", g1,  5, 25, 200, 125, 0, 0)
    te2 = createEx(Combo, "control2", g2, 10, 27, 200, 125, 0, 0)
    te3 = createEx(Combo, "control3", g3, 15, 29, 200, 125, 0, 0)
    te4 = createEx(Combo, "control4", g4, 20, 31, 200, 125, 0, 0)

    -------------------- SELECT TAB ITEM --------------------
    -- select second item (number 1)
    Void = sendMessage (tc, TCM_SETCURSEL, 1, 0)

    -------------------- DELETE TAB ITEM --------------------
    -- delete third item (number 2)
    Void = sendMessage (tc, TCM_DELETEITEM, 2, 0)

    WinMain(win, Normal)

end procedure

main()

new topic     » goto parent     » topic index » view message » categorize

5. Re: [WIN32Lib] programmatically select tab item?

Tone,

Thanks a lot!   I had found info about sendMessage, & tried using it, but my
usage only partly worked, while yours seems to work fine.  Mine didn't move
associated controls to the correct tabs after one was deleted, but yours did
that just fine, so I'll try to see what's different.

Thanks again :)

Dan




----- Original Message -----
From: <tone.skoda at siol.net>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, March 23, 2002 3:19 AM
Subject: Re: [WIN32Lib] programmatically select tab item?


>
> Dan Moyer wrote:
> > how would I use
> > TCM_DELETEITEM & TCM_SETCURSEL
> > in a program using Win32Lib?
>
> It's pretty simple, below is example. There may be some issues with
Win32Lib
> because it's not expecting that you do this.
> To Derek: These actions should become possible to do this with Win32Lib's
> functions
> deleteItem () and selectItem () (this one doesn't exist yet)
>
> Syntax:
>
> Void = sendMessage (tabControl window, message (action), index of tab item
> to delete starting at 0, 0)
>
> -- select and delete tab items.exw
>
> without warning
> with trace
> include win32lib.ew
>
> integer win, tc, t1, t2, t3, t4
> integer te1, te2, te3, te4
> integer g1, g2, g3, g4
> object Void
>
> procedure main()
>     win = createEx(Window, "Test Tabcontrol", 0, 0, 0, 640, 480, 0, 0)
>     tc  = createEx(TabControl, "", win, 5, 25, 600, 400, 0, 0)
>     t1 = createEx(TabItem, "One",   tc, 5, 25, 590, 390, 0, 0)
>     t2 = createEx(TabItem, "Two",   tc, 5, 25, 590, 390, 0, 0)
>     t3 = createEx(TabItem, "Three", tc, 5, 25, 590, 390, 0, 0)
>     t4 = createEx(TabItem, "Four",  tc, 5, 25, 590, 390, 0, 0)
>
>     g1 = createEx(Group, " group 1", t1, 5, 25, 400, 300, 0, 0)
>     g2 = createEx(Group, " group 2", t2, 5, 25, 400, 300, 0, 0)
>     g3 = createEx(Group, " group 3", t3, 5, 25, 400, 300, 0, 0)
>     g4 = createEx(Group, " group 4", t4, 5, 25, 400, 300, 0, 0)
>
>     te1 = createEx(Combo, "control1", g1,  5, 25, 200, 125, 0, 0)
>     te2 = createEx(Combo, "control2", g2, 10, 27, 200, 125, 0, 0)
>     te3 = createEx(Combo, "control3", g3, 15, 29, 200, 125, 0, 0)
>     te4 = createEx(Combo, "control4", g4, 20, 31, 200, 125, 0, 0)
>
>     -------------------- SELECT TAB ITEM --------------------
>     -- select second item (number 1)
>     Void = sendMessage (tc, TCM_SETCURSEL, 1, 0)
>
>     -------------------- DELETE TAB ITEM --------------------
>     -- delete third item (number 2)
>     Void = sendMessage (tc, TCM_DELETEITEM, 2, 0)
>
>     WinMain(win, Normal)
>
> end procedure
>
> main()
>

new topic     » goto parent     » topic index » view message » categorize

6. Re: [WIN32Lib] programmatically select tab item?

Tone,

Looks like I spoke too soon, your example manifests the same problem I
encountered:  child controls of the tabitems aren't properly "moved" to the
remaining tabitems when a tabitem is deleted.  Look at the folder numbered
*four* in your example, you'll see that it has the group control for folder
# *THREE* in it.

  I expected that deleting a tabItem from a folder would "carry" the
associated controls from all the succeeding tabitems with them, but instead
the original assignments appear to be "copied" to the new tabitems; so,
folders 1 & 2 have the proper (old) assignments of groups 1 & 2, but after
deleting folder "three", folder named "four", in *position* number 3, shows
group #3 in it.

So, does anyone know if there is some way to "re-assign" controls after
they've been created, so I could make the lists that are displayed with each
tabitem be correct?

I tried "destroy"ing the deleted tabitem, but it seems that may have
actually destroyed the entire tabCONTROL.  Also, in my actual program, I did
delete the deleted folder handle from the handle variable, but that was just
so correct data would be written to a file afterward, I don't think that
could possibly have any effect on the association of control to parent.

Dan

Here's an example program I made to test what Tone showed me:

-- code begins:

--  code generated by Win32Lib IDE v0.10.4

include Win32Lib.ew
without warning


--  Window Window1
global constant Window1 = create( Window, "Window1", 0, Default, Default,
400, 300, 0 )

constant
    aStatusBar      = create( StatusBar, "", Window1, 0, 25, 20, 20, 0)

global constant aTabControl = create( TabControl, "TabControl", Window1, 48,
56, 292, 204, 0 )

for n = 1 to 5 do  -- make 5 tab items:
 Tabs &=  create(TabItem,"TabItem" & sprint(n), aTabControl, 0, 0, 0, 0, 0 )
end for

for n = 1 to 5 do  -- make 5 lists, one for each tab item:
  Lists &= create( List, "List" & sprint(n), Tabs[n], 24, 36, 248, 140, 0 )
end for

global constant PushButtonDelTab = create( PushButton, "Delete Selected Tab
Item", Window1, 88, 8, 184, 32, 0 )
end for

procedure onClick_PushButtonDelTab()
object tabSelected
  tabSelected = sendMessage(aTabControl,TCM_GETCURSEL, 0 ,0 )
  setText(aStatusBar, sprint(tabSelected))
  result = sendMessage(aTabControl,TCM_DELETEITEM,tabSelected, 0 )
  if sendMessage(aTabControl,TCM_GETITEMCOUNT,0,0)= tabSelected then
     --last tab removed, so gotta backup one:
     result = sendMessage(aTabControl,TCM_SETCURSEL,tabSelected-1, 0 )
  else
    result = sendMessage(aTabControl,TCM_SETCURSEL,tabSelected, 0 )
  end if
 -- destroy(Lists[tabSelected+1])-- HANDLE ERROR, maybe destroys whole
tabcontrol??
end procedure

onClick[PushButtonDelTab]   = routine_id("onClick_PushButtonDelTab")

WinMain( Window1, Normal )

-- code ends



----- Original Message -----
From: <tone.skoda at siol.net>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, March 23, 2002 3:19 AM
Subject: Re: [WIN32Lib] programmatically select tab item?


>
> Dan Moyer wrote:
> > how would I use
> > TCM_DELETEITEM & TCM_SETCURSEL
> > in a program using Win32Lib?
>
> It's pretty simple, below is example. There may be some issues with
Win32Lib
> because it's not expecting that you do this.
> To Derek: These actions should become possible to do this with Win32Lib's
> functions
> deleteItem () and selectItem () (this one doesn't exist yet)
>
> Syntax:
>
> Void = sendMessage (tabControl window, message (action), index of tab item
> to delete starting at 0, 0)
>
> -- select and delete tab items.exw
>
> without warning
> with trace
> include win32lib.ew
>
> integer win, tc, t1, t2, t3, t4
> integer te1, te2, te3, te4
> integer g1, g2, g3, g4
> object Void
>
> procedure main()
>     win = createEx(Window, "Test Tabcontrol", 0, 0, 0, 640, 480, 0, 0)
>     tc  = createEx(TabControl, "", win, 5, 25, 600, 400, 0, 0)
>     t1 = createEx(TabItem, "One",   tc, 5, 25, 590, 390, 0, 0)
>     t2 = createEx(TabItem, "Two",   tc, 5, 25, 590, 390, 0, 0)
>     t3 = createEx(TabItem, "Three", tc, 5, 25, 590, 390, 0, 0)
>     t4 = createEx(TabItem, "Four",  tc, 5, 25, 590, 390, 0, 0)
>
>     g1 = createEx(Group, " group 1", t1, 5, 25, 400, 300, 0, 0)
>     g2 = createEx(Group, " group 2", t2, 5, 25, 400, 300, 0, 0)
>     g3 = createEx(Group, " group 3", t3, 5, 25, 400, 300, 0, 0)
>     g4 = createEx(Group, " group 4", t4, 5, 25, 400, 300, 0, 0)
>
>     te1 = createEx(Combo, "control1", g1,  5, 25, 200, 125, 0, 0)
>     te2 = createEx(Combo, "control2", g2, 10, 27, 200, 125, 0, 0)
>     te3 = createEx(Combo, "control3", g3, 15, 29, 200, 125, 0, 0)
>     te4 = createEx(Combo, "control4", g4, 20, 31, 200, 125, 0, 0)
>
>     -------------------- SELECT TAB ITEM --------------------
>     -- select second item (number 1)
>     Void = sendMessage (tc, TCM_SETCURSEL, 1, 0)
>
>     -------------------- DELETE TAB ITEM --------------------
>     -- delete third item (number 2)
>     Void = sendMessage (tc, TCM_DELETEITEM, 2, 0)
>
>     WinMain(win, Normal)
>
> end procedure
>
> main()
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

7. Re: [WIN32Lib] programmatically select tab item?

Dan,
this sort of thing needs to be done inside the library as there are a few
associated housekeeping variables that will need updating too. Let me think
about it a bit.

I am assuming that if you destroy a tabitem, that all its contained controls
will also be destroyed. Is that what you are after?

Also, does anyone have a need to move a control from one parent control to
another?

-----------
Derek.

----- Original Message -----
From: "Dan Moyer" <DANIELMOYER at prodigy.net>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, March 24, 2002 3:16 PM
Subject: Re: [WIN32Lib] programmatically select tab item?


>
> Tone,
>
> Looks like I spoke too soon, your example manifests the same problem I
> encountered:  child controls of the tabitems aren't properly "moved" to
the
> remaining tabitems when a tabitem is deleted.  Look at the folder numbered
> *four* in your example, you'll see that it has the group control for
folder
> # *THREE* in it.
>
>   I expected that deleting a tabItem from a folder would "carry" the
> associated controls from all the succeeding tabitems with them, but
instead
> the original assignments appear to be "copied" to the new tabitems; so,
> folders 1 & 2 have the proper (old) assignments of groups 1 & 2, but after
> deleting folder "three", folder named "four", in *position* number 3,
shows
> group #3 in it.
>
> So, does anyone know if there is some way to "re-assign" controls after
> they've been created, so I could make the lists that are displayed with
each
> tabitem be correct?
>
> I tried "destroy"ing the deleted tabitem, but it seems that may have
> actually destroyed the entire tabCONTROL.  Also, in my actual program, I
did
> delete the deleted folder handle from the handle variable, but that was
just
> so correct data would be written to a file afterward, I don't think that
> could possibly have any effect on the association of control to parent.
>
> Dan
>
> Here's an example program I made to test what Tone showed me:
>
> -- code begins:
>
> --  code generated by Win32Lib IDE v0.10.4
>
> include Win32Lib.ew
> without warning
>
>
> --  Window Window1
> global constant Window1 = create( Window, "Window1", 0, Default, Default,
> 400, 300, 0 )
>
> constant
>     aStatusBar      = create( StatusBar, "", Window1, 0, 25, 20, 20, 0)
>
> global constant aTabControl = create( TabControl, "TabControl", Window1,
48,
> 56, 292, 204, 0 )
>
> for n = 1 to 5 do  -- make 5 tab items:
>  Tabs &=  create(TabItem,"TabItem" & sprint(n), aTabControl, 0, 0, 0, 0,
0 )
> end for
>
> for n = 1 to 5 do  -- make 5 lists, one for each tab item:
>   Lists &= create( List, "List" & sprint(n), Tabs[n], 24, 36, 248, 140,
0 )
> end for
>
> global constant PushButtonDelTab = create( PushButton, "Delete Selected
Tab
> Item", Window1, 88, 8, 184, 32, 0 )
> end for
>
> procedure onClick_PushButtonDelTab()
> object tabSelected
>   tabSelected = sendMessage(aTabControl,TCM_GETCURSEL, 0 ,0 )
>   setText(aStatusBar, sprint(tabSelected))
>   result = sendMessage(aTabControl,TCM_DELETEITEM,tabSelected, 0 )
>   if sendMessage(aTabControl,TCM_GETITEMCOUNT,0,0)= tabSelected then
>      --last tab removed, so gotta backup one:
>      result = sendMessage(aTabControl,TCM_SETCURSEL,tabSelected-1, 0 )
>   else
>     result = sendMessage(aTabControl,TCM_SETCURSEL,tabSelected, 0 )
>   end if
>  -- destroy(Lists[tabSelected+1])-- HANDLE ERROR, maybe destroys whole
> tabcontrol??
> end procedure
>
> onClick[PushButtonDelTab]   = routine_id("onClick_PushButtonDelTab")
>
> WinMain( Window1, Normal )
>
> -- code ends
>
>
> ----- Original Message -----
> From: <tone.skoda at siol.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Saturday, March 23, 2002 3:19 AM
> Subject: Re: [WIN32Lib] programmatically select tab item?
>
>
> > Dan Moyer wrote:
> > > how would I use
> > > TCM_DELETEITEM & TCM_SETCURSEL
> > > in a program using Win32Lib?
> >
> > It's pretty simple, below is example. There may be some issues with
> Win32Lib
> > because it's not expecting that you do this.
> > To Derek: These actions should become possible to do this with
Win32Lib's
> > functions
> > deleteItem () and selectItem () (this one doesn't exist yet)
> >
> > Syntax:
> >
> > Void = sendMessage (tabControl window, message (action), index of tab
item
> > to delete starting at 0, 0)
> >
> > -- select and delete tab items.exw
> >
> > without warning
> > with trace
> > include win32lib.ew
> >
> > integer win, tc, t1, t2, t3, t4
> > integer te1, te2, te3, te4
> > integer g1, g2, g3, g4
> > object Void
> >
> > procedure main()
> >     win = createEx(Window, "Test Tabcontrol", 0, 0, 0, 640, 480, 0, 0)
> >     tc  = createEx(TabControl, "", win, 5, 25, 600, 400, 0, 0)
> >     t1 = createEx(TabItem, "One",   tc, 5, 25, 590, 390, 0, 0)
> >     t2 = createEx(TabItem, "Two",   tc, 5, 25, 590, 390, 0, 0)
> >     t3 = createEx(TabItem, "Three", tc, 5, 25, 590, 390, 0, 0)
> >     t4 = createEx(TabItem, "Four",  tc, 5, 25, 590, 390, 0, 0)
> >
> >     g1 = createEx(Group, " group 1", t1, 5, 25, 400, 300, 0, 0)
> >     g2 = createEx(Group, " group 2", t2, 5, 25, 400, 300, 0, 0)
> >     g3 = createEx(Group, " group 3", t3, 5, 25, 400, 300, 0, 0)
> >     g4 = createEx(Group, " group 4", t4, 5, 25, 400, 300, 0, 0)
> >
> >     te1 = createEx(Combo, "control1", g1,  5, 25, 200, 125, 0, 0)
> >     te2 = createEx(Combo, "control2", g2, 10, 27, 200, 125, 0, 0)
> >     te3 = createEx(Combo, "control3", g3, 15, 29, 200, 125, 0, 0)
> >     te4 = createEx(Combo, "control4", g4, 20, 31, 200, 125, 0, 0)
> >
> >     -------------------- SELECT TAB ITEM --------------------
> >     -- select second item (number 1)
> >     Void = sendMessage (tc, TCM_SETCURSEL, 1, 0)
> >
> >     -------------------- DELETE TAB ITEM --------------------
> >     -- delete third item (number 2)
> >     Void = sendMessage (tc, TCM_DELETEITEM, 2, 0)
> >
> >     WinMain(win, Normal)
> >
> > end procedure
> >
> > main()
> >
> >
>
>
>

new topic     » goto parent     » topic index » view message » categorize

8. Re: [WIN32Lib] programmatically select tab item?

Derek,

Yes, destroy a tab item, then all contained controls should be destroyed
too, but more  important is to make sure all contained controls for tabitems
to the right of the deleted one be "shifted" one to the left so they're
correctly associated with the tabitems that remain.

Dan


----- Original Message -----
From: "Derek Parnell" <ddparnell at bigpond.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: [WIN32Lib] programmatically select tab item?


>
> Dan,
> this sort of thing needs to be done inside the library as there are a few
> associated housekeeping variables that will need updating too. Let me
think
> about it a bit.
>
> I am assuming that if you destroy a tabitem, that all its contained
controls
> will also be destroyed. Is that what you are after?
>
> Also, does anyone have a need to move a control from one parent control to
> another?
>
> -----------
> Derek.
>
> ----- Original Message -----
> From: "Dan Moyer" <DANIELMOYER at prodigy.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Sunday, March 24, 2002 3:16 PM
> Subject: Re: [WIN32Lib] programmatically select tab item?
>
>
> > Tone,
> >
> > Looks like I spoke too soon, your example manifests the same problem I
> > encountered:  child controls of the tabitems aren't properly "moved" to
> the
> > remaining tabitems when a tabitem is deleted.  Look at the folder
numbered
> > *four* in your example, you'll see that it has the group control for
> folder
> > # *THREE* in it.
> >
> >   I expected that deleting a tabItem from a folder would "carry" the
> > associated controls from all the succeeding tabitems with them, but
> instead
> > the original assignments appear to be "copied" to the new tabitems; so,
> > folders 1 & 2 have the proper (old) assignments of groups 1 & 2, but
after
> > deleting folder "three", folder named "four", in *position* number 3,
> shows
> > group #3 in it.
> >
> > So, does anyone know if there is some way to "re-assign" controls after
> > they've been created, so I could make the lists that are displayed with
> each
> > tabitem be correct?
> >
> > I tried "destroy"ing the deleted tabitem, but it seems that may have
> > actually destroyed the entire tabCONTROL.  Also, in my actual program, I
> did
> > delete the deleted folder handle from the handle variable, but that was
> just
> > so correct data would be written to a file afterward, I don't think that
> > could possibly have any effect on the association of control to parent.
> >
> > Dan
> >
> > Here's an example program I made to test what Tone showed me:
> >
> > -- code begins:
> >
> > --  code generated by Win32Lib IDE v0.10.4
> >
> > include Win32Lib.ew
> > without warning
> >
> >
> > --  Window Window1
> > global constant Window1 = create( Window, "Window1", 0, Default,
Default,
> > 400, 300, 0 )
> >
> > constant
> >     aStatusBar      = create( StatusBar, "", Window1, 0, 25, 20, 20, 0)
> >
> > global constant aTabControl = create( TabControl, "TabControl", Window1,
> 48,
> > 56, 292, 204, 0 )
> >
> > for n = 1 to 5 do  -- make 5 tab items:
> >  Tabs &=  create(TabItem,"TabItem" & sprint(n), aTabControl, 0, 0, 0, 0,
> 0 )
> > end for
> >
> > for n = 1 to 5 do  -- make 5 lists, one for each tab item:
> >   Lists &= create( List, "List" & sprint(n), Tabs[n], 24, 36, 248, 140,
> 0 )
> > end for
> >
> > global constant PushButtonDelTab = create( PushButton, "Delete Selected
> Tab
> > Item", Window1, 88, 8, 184, 32, 0 )
> > end for
> >
> > procedure onClick_PushButtonDelTab()
> > object tabSelected
> >   tabSelected = sendMessage(aTabControl,TCM_GETCURSEL, 0 ,0 )
> >   setText(aStatusBar, sprint(tabSelected))
> >   result = sendMessage(aTabControl,TCM_DELETEITEM,tabSelected, 0 )
> >   if sendMessage(aTabControl,TCM_GETITEMCOUNT,0,0)= tabSelected then
> >      --last tab removed, so gotta backup one:
> >      result = sendMessage(aTabControl,TCM_SETCURSEL,tabSelected-1, 0 )
> >   else
> >     result = sendMessage(aTabControl,TCM_SETCURSEL,tabSelected, 0 )
> >   end if
> >  -- destroy(Lists[tabSelected+1])-- HANDLE ERROR, maybe destroys whole
> > tabcontrol??
> > end procedure
> >
> > onClick[PushButtonDelTab]   = routine_id("onClick_PushButtonDelTab")
> >
> > WinMain( Window1, Normal )
> >
> > -- code ends
> >
> >
> > ----- Original Message -----
> > From: <tone.skoda at siol.net>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Saturday, March 23, 2002 3:19 AM
> > Subject: Re: [WIN32Lib] programmatically select tab item?
> >
> >
> > > Dan Moyer wrote:
> > > > how would I use
> > > > TCM_DELETEITEM & TCM_SETCURSEL
> > > > in a program using Win32Lib?
> > >
> > > It's pretty simple, below is example. There may be some issues with
> > Win32Lib
> > > because it's not expecting that you do this.
> > > To Derek: These actions should become possible to do this with
> Win32Lib's
> > > functions
> > > deleteItem () and selectItem () (this one doesn't exist yet)
> > >
> > > Syntax:
> > >
> > > Void = sendMessage (tabControl window, message (action), index of tab
> item
> > > to delete starting at 0, 0)
> > >
> > > -- select and delete tab items.exw
> > >
> > > without warning
> > > with trace
> > > include win32lib.ew
> > >
> > > integer win, tc, t1, t2, t3, t4
> > > integer te1, te2, te3, te4
> > > integer g1, g2, g3, g4
> > > object Void
> > >
> > > procedure main()
> > >     win = createEx(Window, "Test Tabcontrol", 0, 0, 0, 640, 480, 0, 0)
> > >     tc  = createEx(TabControl, "", win, 5, 25, 600, 400, 0, 0)
> > >     t1 = createEx(TabItem, "One",   tc, 5, 25, 590, 390, 0, 0)
> > >     t2 = createEx(TabItem, "Two",   tc, 5, 25, 590, 390, 0, 0)
> > >     t3 = createEx(TabItem, "Three", tc, 5, 25, 590, 390, 0, 0)
> > >     t4 = createEx(TabItem, "Four",  tc, 5, 25, 590, 390, 0, 0)
> > >
> > >     g1 = createEx(Group, " group 1", t1, 5, 25, 400, 300, 0, 0)
> > >     g2 = createEx(Group, " group 2", t2, 5, 25, 400, 300, 0, 0)
> > >     g3 = createEx(Group, " group 3", t3, 5, 25, 400, 300, 0, 0)
> > >     g4 = createEx(Group, " group 4", t4, 5, 25, 400, 300, 0, 0)
> > >
> > >     te1 = createEx(Combo, "control1", g1,  5, 25, 200, 125, 0, 0)
> > >     te2 = createEx(Combo, "control2", g2, 10, 27, 200, 125, 0, 0)
> > >     te3 = createEx(Combo, "control3", g3, 15, 29, 200, 125, 0, 0)
> > >     te4 = createEx(Combo, "control4", g4, 20, 31, 200, 125, 0, 0)
<snip>

>
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu