1. [Win] delete tabItem not correctly re-associate controls

Derek, anyone,

Anyone know how to make TCM_DELETEITEM work correctly (so as to re-associate
child controls properly with all tabs after one is deleted)?

Tone found for me the TCM_DELETEITEM & showed how to use it to delete a
tabItem, but as can be seen from running his code, the controls associated
with tabs are not all correctly re-associated after a deletion, such that if
you delete the 3rd tab, the 4th tab now shows up in the third place, but
instead of having the controls that were in the 4th tab, that tab now
contains the controls that were previously in the 3rd tab, and so forth for
all tabs to the right of the deleted one.

Maybe I'm missing something about how to use TCM_DELETEITEM correctly, like
another command to re-associate controls, but I couldn't find anything like
that where I looked at :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/pla
tform/commctls/tab/tab.asp

(I don't know what "shellcc" in the above site address is, so maybe I'm not
looking in the right place?  I originally looked at a page that was for
"ce", which I suppose is "compact edition", which would almost certainly not
be where I would want to look.)

Here's Tone's example, if you run it, you'll see what I mean:

-- 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     » topic index » view message » categorize

2. Re: [Win] delete tabItem not correctly re-associate controls

>
> Anyone know how to make TCM_DELETEITEM work correctly (so as to
re-associate
> child controls properly with all tabs after one is deleted)?

This will be addressed in the forcoming v0.57 release of win32lib. (Only
days away now)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu