Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Removing Tabs from tab control
#11
Hi Gintaras,
I am using a tabcontrol with button styles but want to make it so that each button becomes "undepressed" immediately after each push so that the action from depressing the tab/button can be repeated. Ideally, that button will still stay highlighted, which I know is a distinct state from whether it is actually depressed (I think focus vs selected, but I am note sure).
Thanks!
Stuart

Function TabControlVariations
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages


if(!ShowDialog("TabControlVariations" &TabControlVariations)) ret

;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 571 63 "Form"
;1 Button 0x54030001 0x4 272 46 48 14 "OK"
;2 Button 0x54030000 0x4 330 46 48 14 "Cancel"
;4 Button 0x54032040 0x4 386 46 18 14 "?"
;3 SysTabControl32 0x54000340 0x0 0 2 266 60 ""
;16 Button 0x54032000 0x0 270 4 50 22 "Add Tab"
;17 Button 0x54032000 0x0 322 4 50 22 "Delete Selected Tab"
;18 Button 0x54032300 0x0 376 4 48 22 "Delete All Tabs"
;END DIALOG
;DIALOG EDITOR: "" 0x2030208 "" "" ""

def TCS_HOTTRACK 0x0040
def TCS_MULTILINE 0x0200
def TCS_BUTTONS 0x0100

ret
;messages
sel message
,case WM_INITDIALOG    
,int+ htb3=id(3 hDlg)
,for _i 0 10
,,_s=_i
,,TCITEM ti.mask=WINAPI.TCIF_TEXT    
,,ti.pszText= _s
,,SendMessage htb3 WINAPI.TCM_INSERTITEMA _i &ti    

,
,goto g11
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 16;;add tab htb3
,,int TabCount = SendMessage(htb3 WINAPI.TCM_GETITEMCOUNT 0 0);; wParam and lParam must both be zero (see MSDN link http://msdn.microsoft.com/en-us/library/bb760592(v=VS.85).aspx)    
,,str TabText
,,TC_GetTabText htb3 TabCount-1 TabText;;TabCount -1 because zero order tab index but total number of tabs is 1-order
,,int TabTextToVal = val(TabText)
,,str NextHighterTab = TabTextToVal+1
,,TCITEM TabName.mask=WINAPI.TCIF_TEXT
,,TabName.pszText = NextHighterTab
,,SendMessage htb3 WINAPI.TCM_INSERTITEMA TabCount+1 &TabName;; so that it adds it as the nexth (zero-order) tab        

,case 17;;Delete Selected Tab
,,int SelectedTab = SendMessage(htb3 WINAPI.TCM_GETCURSEL 0 0);;Determines the currently selected tab in a tab control, wParam and lParam must be zero, returns selected tab index or -1 if no tab selected
,,SendMessage htb3 WINAPI.TCM_DELETEITEM SelectedTab 0  ;; Removes an item from a tab control, wParam = index of item to delete, lParam must be zero)
,case 18;; Delete All Tabs
,,SendMessage htb3 WINAPI.TCM_DELETEALLITEMS 0 0;;


ret 1
;messages3
NMHDR* nh=+lParam
sel nh.code
,case WINAPI.TCN_SELCHANGE
,_i=SendMessage(nh.hwndFrom WINAPI.TCM_GETCURSEL 0 0)
,;g11
,DT_Page hDlg _i


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)