Re: [WIN32Lib] programmatically select tab item?

new topic     » goto parent     » topic index » view thread      » older message » newer message

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 thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu