CyberSlug Posted April 18, 2004 Share Posted April 18, 2004 Not sure where to post this message, but I have been playing with the SysTabControl in autoit-gui.102.17 and I have to say It even supports dynamic control creation!!! There is one quirk, but it can be very low priority on the to-do list because workarounds existQuirk If you dynamically create a new Tab containing new controls, then:1) The old controls from the previous Tab do not disappear until you toggle between the Tabs a few times2) The new controls on the new Tab do not appear until you create another Tab.Sample script with workarounds:expandcollapse popupOpt("GUINotifyMode", 1) $count = 1 $TCM_DELETEITEM = 4872 GuiCreate("TitleFoo", 500, 500) WinActivate("TitleFoo") $Add = GUISetControl("button", "New tab", 300, 300) $tab = GUISetControl("tab", "", 0, 0, 300, 300) GUISetControl("tabitem", "1", 0, 0);, 300, 300) GUISetControl("edit", "Edit on tab #" & $count , 40, 40, 150, 150) GuiShow() While 1 sleep(100) $msg = GuiMsg(0) If $count >= 5 Then GuiWrite($Add, 128) ;disable the button Select Case -3 = $msg Exit Case $Add = $msg $count = $count + 1 ; Make sure rightmost tab is active so that new tab is inserted ; at the far right. For $i = 1 to $count ControlCommand("","","SysTabControl321", "TabRight","") Next ; Create new tab with button GUISetControl("tabitem", $count, 0, 0) GUISetControl("edit", "Edit on tab #" & $count , 40, 40, 150, 150) ; Refreshs the tabs so that 'Button on tab #1' does not hang around ControlCommand("","","SysTabControl321", "TabRight","") ControlCommand("","","SysTabControl321", "TabLeft","") ControlCommand("","","SysTabControl321", "TabRight","") ControlCommand("","","SysTabControl321", "TabLeft","") ; Activate new tab ControlCommand("","","SysTabControl321", "TabRight","") ; In order for 'Editon tab #x' to appear, I must create another tab ; (and then I delete it) GUISetControl("tabitem", " ", 0, 0) ControlCommand("","","SysTabControl321", "TabRight","") GuiSendMsg($tab, $TCM_DELETEITEM, $count, 0) ;Re-activate new tab For $i = 1 to $count ControlCommand("","","SysTabControl321", "TabRight","") Next EndSelect WEnd ExitNote: ControlCommands will soon be replaced with native GUI functions. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
jpm Posted April 18, 2004 Share Posted April 18, 2004 WHy don't you use the basic in 102.17B The tab numbering start at 0 and the closing of the tab definition is with "". expandcollapse popupOpt("GUINotifyMode", 1) $count = 0 #include "GUI_Message.au3" GuiCreate("TitleFoo", 500, 500) WinActivate("TitleFoo") $Add = GUISetControl("button", "New tab", 300, 300) $tab = GUISetControl("tab", "", 0, 0, 300, 300) GUISetControl("tabitem", $count, 0, 0);, 300, 300) GUISetControl("edit", "Edit on tab #" & $count , 40, 40, 150, 150) GuiShow() While 1 sleep(100) $msg = GuiMsg(0) If $count >= 5 Then GuiWrite($Add, 128);disable the button Select Case -3 = $msg Exit Case $Add = $msg GuiSendMsg($tab, $TCM_SETCURSEL, $count, 0) $count = $count + 1 ; Create new tab with button GUISetControl("tabitem", $count, 0, 0) GUISetControl("edit", "Edit on tab #" & $count , 40, 50, 150, 150) GUISetControl("tabitem", "", 0, 0); close tab definition GuiSendMsg($tab, $TCM_SETCURFOCUS, $count, 0) EndSelect WEnd Exit with the include being expandcollapse popup;Edit/input control Messages Global $EM_GETSEL = 0x00B0 Global $EM_SETSEL = 0x00B1 Global $EM_GETRECT = 0x00B2 Global $EM_SETRECT = 0x00B3 Global $EM_SETRECTNP = 0x00B4 Global $EM_SCROLL = 0x00B5 Global $EM_LINESCROLL = 0x00B6 Global $EM_SCROLLCARET = 0x00B7 Global $EM_GETMODIFY = 0x00B8 Global $EM_SETMODIFY = 0x00B9 Global $EM_GETLINECOUNT = 0x00BA Global $EM_LINEINDEX = 0x00BB Global $EM_SETHANDLE = 0x00BC Global $EM_GETHANDLE = 0x00BD Global $EM_GETTHUMB = 0x00BE Global $EM_LINELENGTH = 0x00C1 Global $EM_REPLACESEL = 0x00C2 Global $EM_GETLINE = 0x00C4 Global $EM_LIMITTEXT = 0x00C5 Global $EM_CANUNDO = 0x00C6 Global $EM_UNDO = 0x00C7 Global $EM_FMTLINES = 0x00C8 Global $EM_LINEFROMCHAR = 0x00C9 Global $EM_SETTABSTOPS = 0x00CB Global $EM_SETPASSWORDCHAR = 0x00CC Global $EM_EMPTYUNDOBUFFER = 0x00CD Global $EM_GETFIRSTVISIBLELINE= 0x00CE Global $EM_SETREADONLY = 0x00CF Global $EM_SETWORDBREAKPROC = 0x00D0 Global $EM_GETWORDBREAKPROC = 0x00D1 Global $EM_GETPASSWORDCHAR = 0x00D2 Global $EM_SETMARGINS = 0x00D3 Global $EM_GETMARGINS = 0x00D4 Global $EM_GETLIMITTEXT = 0x00D5 Global $EM_POSFROMCHAR = 0x00D6 Global $EM_CHARFROMPOS = 0x00D7 Global $EM_SETIMESTATUS = 0x00D8 Global $EM_GETIMESTATUS = 0x00D9 ; Tab control messages Global $TCM_DELETEALLITEMS = 0x1309 Global $TCM_DELETEITEM = 0x1308 Global $TCM_DESELECTALL = 0x1332 Global $TCM_GETCURFOCUS = 0x132F Global $TCM_GETCURSEL = 0x130B Global $TCM_GETEXTENDEDSTYLE= 0x1335 Global $TCM_GETITEMCOUNT = 0x1304 Global $TCM_GETITEMRECT = 0x130A Global $TCM_GETROWCOUNT = 0x132C Global $TCM_HIGHLIGHTITEM = 0x1333 Global $TCM_SETCURFOCUS = 0x1330 Global $TCM_SETCURSEL = 0x130C Global $TCM_SETEXTENDEDSTYLE= 0x1334 Global $TCM_SETITEMSIZE = 0x1329 Global $TCM_SETMINTABWIDTH = 0x1331 Global $TCM_SETPADDING = 0x132B ;Up-down Control messages Global $UDM_GETBASE = 0x400+110 Global $UDM_GETPOS = 0x400+104 Global $UDM_GETRANGE = 0x400+102 Global $UDM_SETBASE = 0x400+109 Global $UDM_SETPOS = 0x400+103 Global $UDM_SETRANGE = 0x400+101 ;Date control messages Global $DTM_GETMCCOLOR = 0x1007 Global $DTM_SETFORMAT = 0x1005 Global $DTM_SETMCCOLOR = 0x1006 Link to comment Share on other sites More sharing options...
CyberSlug Posted April 18, 2004 Author Share Posted April 18, 2004 I promise to use #include "GUI_Message.au3" more jpm, because you do not force the new tab to be inserted at the far right, there can be problems....Try this with your example:- Click "New Tab" button- Click Tab #0- Click "New Tab" button- Click Tab #2- Click Tab #1Notice that Tab #1 is blank Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
jpm Posted April 18, 2004 Share Posted April 18, 2004 I promise to use #include "GUI_Message.au3" more jpm, because you do not force the new tab to be inserted at the far right, there can be problems....Try this with your example:- Click "New Tab" button- Click Tab #0- Click "New Tab" button- Click Tab #2- Click Tab #1Notice that Tab #1 is blankI think about and I will report what happening Link to comment Share on other sites More sharing options...
jpm Posted April 18, 2004 Share Posted April 18, 2004 @CyberSlug I miss a line Case $Add = $msg GuiSendMsg($tab, $TCM_SETCURFOCUS, $count, 0) This SendMessage stuff can be too advanced for me ... Take care Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now