blink314 Posted November 10, 2005 Share Posted November 10, 2005 If I make a GUI with a tab control containing three tabs and populate those tabs with controls everything works fine. The problem is that if I delete a control (say a listview) to refresh it and then recreate it, it does not "hold" to the tab and is visible no matter which tab I select. Is there any way around this? The ListView is particularly hard to refresh. I tried deleting all items, all columns (except 0) and adding columns and items back in... but this does not work. I cannot get the items to create. I am trying to use one listview to display different sets of data. These sets have random listitem counts and random numbers of differently named headings. That's why I originally just deleted the listview. It appears, however that unless you recreate the listview within the initial tab creation, the tab does not recognize it as part of its control. Any ideas or work arounds??? Kevin Link to comment Share on other sites More sharing options...
blink314 Posted November 10, 2005 Author Share Posted November 10, 2005 Here is a sample for you to try. Run the program and click on each tab. Then go back to the second tab and press the button. Now go to each tab again... the listview appears in each tab! expandcollapse popup#include <GuiConstants.au3> #include <GUIListview.au3> opt("GUIOnEventMode", 1) opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client ;GUI variables $xBorderL = 7;distance from left side of gui $xBorderR = 7;distance from right side of gui $yBorderTier1 = 1;Tier 1 distance from top of gui $yBorderTier2 = 30;Tier 2 distance from top of gui $yBorderTier3 = 410;Tier 3 distance from top of gui $xSpacing = 5;distance between controls in the x dimension $ySpacing = 6;distance between controls in the y dimension $GUIWidth = 1000 $GUIHeight = 710 $Main = GUICreate("Bug Trick", $GUIWidth, $guiheight, (@DesktopWidth - $GUIWidth) / 2, (@DesktopHeight - $GUIHeight) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIevent");This line tells the GUI to close when the "X" is clicked $Tab = GUICtrlCreateTab(5, $yBorderTier1, $GUIWidth - 5 - 5, $GUIHeight - $yBorderTier1 - 25, $TCS_SINGLELINE) $Tab_View = GUICtrlCreateTabItem(" Database View ") GUICtrlCreateTabItem("") $Tab_Database = GUICtrlCreateTabItem(" Raw View ") GUICtrlSetState(-1, $GUI_SHOW) $ListVDBxPos = 300 + $xBorderL + $xSpacing $ListVDB = GUICtrlCreateListView("Field Names...", $ListVDBxPos, $yBorderTier2, $GUIWidth - $ListVDBxPos - $xBorderR, 350 + $ySpacing + 20, $LVS_SHOWSELALWAYS + $LVS_SINGLESEL, $LVS_EX_GRIDLINES + $LVS_EX_FULLROWSELECT) $BugButton = GUICtrlCreateButton("Press For Bug!", 10,60,100,100) GUICtrlSetOnEvent(-1,"BugFunc") GUICtrlCreateTabItem("") $SQL_View = GUICtrlCreateTabItem(" SQL Entry ") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW, $Main) While 1 Sleep(8000) WEnd Exit func BugFunc() guictrldelete($listvdb) $ColumnHeadings = "Col1|Col2|Col3|Col4" $ListVDB = GUICtrlCreateListView($ColumnHeadings, $ListVDBxPos, $yBorderTier2, $GUIWidth - $ListVDBxPos - $xBorderR, 350 + $ySpacing + 20, $LVS_SHOWSELALWAYS + $LVS_SINGLESEL, $LVS_EX_GRIDLINES + $LVS_EX_FULLROWSELECT) for $y = 0 to 20 for $x = 1 to 4 guictrlcreatelistviewitem($x*$y+1 & "|" & $x+$y & "|" & "Help",$listvdb) Next Next EndFunc Func GUIevent() Exit EndFunc ;==>GUIevent Kevin Link to comment Share on other sites More sharing options...
jpm Posted November 10, 2005 Share Posted November 10, 2005 in fact when you delete the listview control you do not specify on which tab you want to recreate it sor the listview is created outside the tab and seem to appear on every tabitem. You need to use GuiSwitch($main,$Tab_Database) before recreation. I anticipate the next question is why the listview does not appear right away. I am looking at. Link to comment Share on other sites More sharing options...
blink314 Posted November 10, 2005 Author Share Posted November 10, 2005 (edited) Yup, that's my next question!! But, thanks for the help. That makes it much nicer already. I would be interested in getting the change to take effect immediately though! After going back and looking at the help for GuiSwitch I see it mentions the tab thing... my next question is why this info isn't included in the tab section! Also, somewhat different subject, I have a script where I delete all treeview items. The problem is that when i recreate the tree and attach an event to some of the treeitems (root nodes) the event is tripped in a visious circle. This happens a bunch of times, then stops. Any ideas? Kevin Edited November 10, 2005 by blink314 Link to comment Share on other sites More sharing options...
jpm Posted November 10, 2005 Share Posted November 10, 2005 Yup, that's my next question!! But, thanks for the help. That makes it much nicer already. I would be interested in getting the change to take effect immediately though!Kevinhere is the complete codefunc BugFunc() guictrldelete($listvdb) $ColumnHeadings = "Col1|Col2|Col3|Col4" GuiSwitch($main,$Tab_Database) $ListVDB = GUICtrlCreateListView($ColumnHeadings, $ListVDBxPos, $yBorderTier2, $GUIWidth - $ListVDBxPos - $xBorderR, 350 + $ySpacing + 20, $LVS_SHOWSELALWAYS + $LVS_SINGLESEL, $LVS_EX_GRIDLINES + $LVS_EX_FULLROWSELECT) for $y = 0 to 20 for $x = 1 to 4 guictrlcreatelistviewitem($x*$y+1 & "|" & $x+$y & "|" & "Help",$listvdb) Next Next GUICtrlSetState($Tab_Database,$GUI_SHOW) EndFunc Link to comment Share on other sites More sharing options...
blink314 Posted November 10, 2005 Author Share Posted November 10, 2005 Beautiful! Thanks a lot! Kevin Link to comment Share on other sites More sharing options...
jpm Posted November 10, 2005 Share Posted November 10, 2005 Beautiful! Thanks a lot!Kevinyou welcome Link to comment Share on other sites More sharing options...
PartyPooper Posted November 11, 2005 Share Posted November 11, 2005 I didn't want to start a new topic because my problem is somewhat related I believe. I am trying to use graphics in tabs and have run into a small problem. With the info jpm posted here, I have stopped the graphic 'bleed-thru' to other tabs using the GuiSwitch() and GUICtrlSetState() functions, but my graphic rectangle is still hidden by the tab control and I cannot seem to push it to the front and onto tab2. Much of the following code comes directly out of the Help File from the GUICtrlCreateTab example. Pressing the OK2 button is supposed to draw a coloured graphic rectangle on tab2 but all I get is the create graphic outline (I added $SS_ETCHEDFRAME so I could see the thing). If you change $GUI_GR_RECT, 40,40,30,40 to $GUI_GR_RECT, 40,140,30,40 you will see the rectangle is being drawn but is hidden (and for some reason I also have to minimise my GUI and then regain it's focus for the rectangle to be displayed below the tabs). Any help would be appreciated. #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $main = GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $tab=GUICtrlCreateTab (10,10, 200,100) $tab0=GUICtrlCreateTabitem ("tab0") GUICtrlCreateLabel ("label0", 30,80,50,20) $tab0OK=GUICtrlCreateButton ("OK0", 20,50,50,20) $tab0input=GUICtrlCreateInput ("default", 80,50,70,20) $tab1=GUICtrlCreateTabitem ( "tab----1") GUICtrlCreateLabel ("label1", 30,80,50,20) $tab1combo=GUICtrlCreateCombo ("", 20,50,60,40) GUICtrlSetData(-1,"Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon $tab1OK=GUICtrlCreateButton ("OK1", 80,50,50,20) $tab2=GUICtrlCreateTabitem ("tab2") GUICtrlSetState(-1,$GUI_SHOW) ; will be display first GUICtrlCreateLabel ("label2", 30,80,50,20) $tab2OK=GUICtrlCreateButton ("OK2", 140,50,50) GUICtrlSetOnEvent(-1, "onclick") GUICtrlCreateTabitem ("") ; end tabitem definition GUICtrlCreateLabel ("label3", 20,130,50,20) GUISetState () ; Run the GUI until the dialog is closed While 1 Sleep(100) Wend Func onclick() GuiSwitch($main,$tab2) $graphicbox = GUICtrlCreateGraphic(20, 35, 110, 70, $SS_ETCHEDFRAME) GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xc0c0ff) $graphic = GUICtrlSetGraphic(-1, $GUI_GR_RECT, 40,40,30,40) GUICtrlSetState($tab2,$GUI_SHOW) EndFunc Func OnExit() Exit EndFunc Link to comment Share on other sites More sharing options...
PartyPooper Posted November 13, 2005 Share Posted November 13, 2005 Anyone have an answer? Sorry, don't mean to be impatient, just scripting has reached a point where if it's not solved, I'll have to go in another direction (creating new windows for graphics instead of using tabs). Link to comment Share on other sites More sharing options...
jpm Posted November 13, 2005 Share Posted November 13, 2005 Anyone have an answer? Sorry, don't mean to be impatient, just scripting has reached a point where if it's not solved, I'll have to go in another direction (creating new windows for graphics instead of using tabs).Graphic are paint on the background they cannot be part of a tabitem as other controls Link to comment Share on other sites More sharing options...
PartyPooper Posted November 14, 2005 Share Posted November 14, 2005 Ahh OK. Thanks jpm. Is it always going to be that way? I guess I'll just use a pop-up window instead to draw my graphics. I'm guessing here because I don't know much about AutoIt and I haven't tried it as yet, but it may be possible to overlay a pop-up window on the tab control (one without frames and controls), draw on it and "hide" the pop-up whenever I clicked on a different tab or that tab lost focus. I'll try some experimenting today. Link to comment Share on other sites More sharing options...
jpm Posted November 14, 2005 Share Posted November 14, 2005 Ahh OK. Thanks jpm. Is it always going to be that way?I guess I'll just use a pop-up window instead to draw my graphics. I'm guessing here because I don't know much about AutoIt and I haven't tried it as yet, but it may be possible to overlay a pop-up window on the tab control (one without frames and controls), draw on it and "hide" the pop-up whenever I clicked on a different tab or that tab lost focus. I'll try some experimenting today.I will think about, but due the implementaion as as drawing in the bakground I think so :"> 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