Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Removing Tabs from tab control
#1
Hi Gintaras,
I am using the following code to have a tab control that displays different text in a single textbox (this is not a multi-page dialog) depending on which tab is selected. The number of tabs and their names change depending on the number of elements in an array (for _i 0 to ContainerArray.len(2) (this is based on the tab control dialogs in the Forum Resources archive)


Code:
Copy      Help
,case WM_INITDIALOG
,,TCITEM ti.mask=WINAPI.TCIF_TEXT
,,int TabCounter
,,for TabCounter 0 ContainerArray.len(2);;I don't know ahead of time how many tabs I will need per instance
,,,,if empty(ContainerArray[0 TabCounter]); break
,,,,ti.pszText=ContainerArray[3 TabCounter];;TabName is the 4th element in the first dimension of the array
,,,,SendMessage htb WINAPI.TCM_INSERTITEMA TabCounter &ti
,,,_s = ContainerArray[4 TabCounter];  _s.setwintext(id(5 hDlg));;Tab-Selected Text is the 5th element in the first dimension of the array    
,,goto g11

When the user selects a tab in the dialog, it gets updated like this:

Code:
Copy      Help
;messages3
NMHDR* nh=+lParam
sel nh.code
,case WINAPI.TCN_SELCHANGE
,_i=SendMessage(nh.hwndFrom WINAPI.TCM_GETCURSEL 0 0)
,_s = ContainerArray[4 _i];  _s.setwintext(id(5 hDlg))
,,goto g11
,;g11
,DT_Page hDlg _i

The next time this is run (differerent case so different number of elements in the array, different tab names, different text in the array), I have been just closing the dialog and then starting over. I think it would be better use of resources to just use same dialog and "refresh" it with new information. I can code this except for the tabs. I don't know how to "erase" the current tabs and refill the space in the dialog with a new
Code:
Copy      Help
;3 SysTabControl32 0x54000300 0x0 0 36 172 342 ""
or keep the SysTabCOntrol32 and just replace the tabs with new ones. I can't simply rename the tabs because I don't know the number of tabs I will need ahead of time.

I hope this is clear. Let me know if I need to explain more. Thanks so much for any help.

Stuart
Living the 'QM' life!


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)