Hooch Posted September 22, 2005 Share Posted September 22, 2005 I have a set of three tabs and I want to hide/unhide 3rd party windows depending on which tab is accessed. I tried guionevent mode, it works when I use a button but not when I tried it with the tab. Suggestions? Link to comment Share on other sites More sharing options...
GaryFrost Posted September 23, 2005 Share Posted September 23, 2005 You mean something like this? CODE #include <GuiConstants.au3> opt("GUIOnEventMode", 1) GUICreate("MyGUI", 392, 323) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents") $TAB = GUICtrlCreateTab(10, 10, 200, 200) GUICtrlSetOnEvent($TAB, "_TabIt") $tab_item1 = GUICtrlCreateTabItem("Tab 1") GUICtrlCreateTabItem("") $tab_item2 = GUICtrlCreateTabItem("Tab 2") GUICtrlCreateTabItem("") $tab_item3 = GUICtrlCreateTabItem("Tab 3") GUICtrlCreateTabItem("") GUISetState() ; Just idle around While 1 Sleep(10) WEnd Func SpecialEvents() Select Case @GUI_CTRLID = $GUI_EVENT_CLOSE MsgBox(0, "Close Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Exit Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE MsgBox(0, "Window Minimized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Case @GUI_CTRLID = $GUI_EVENT_RESTORE MsgBox(0, "Window Restored", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) EndSelect EndFunc ;==>SpecialEvents Func _TabIt() Select Case GUICtrlRead($TAB) = 0 MsgBox(0, "Tab", "1st Tab Selected") Case GUICtrlRead($TAB) = 1 MsgBox(0, "Tab", "2nd Tab Selected") Case GUICtrlRead($TAB) = 2 MsgBox(0, "Tab", "3rd Tab Selected") EndSelect EndFunc ;==>_TabIt SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Hooch Posted September 23, 2005 Author Share Posted September 23, 2005 Awesome, thanks man. I had a working version with guimsg but it just seems so "sloppy" compared to guioneventmode. Thanks much Link to comment Share on other sites More sharing options...
Valuater Posted September 23, 2005 Share Posted September 23, 2005 You mean something like this?CODE#include <GuiConstants.au3>opt("GUIOnEventMode", 1)GUICreate("MyGUI", 392, 323)GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")$TAB = GUICtrlCreateTab(10, 10, 200, 200)GUICtrlSetOnEvent($TAB, "_TabIt")$tab_item1 = GUICtrlCreateTabItem("Tab 1")GUICtrlCreateTabItem("")$tab_item2 = GUICtrlCreateTabItem("Tab 2")GUICtrlCreateTabItem("")$tab_item3 = GUICtrlCreateTabItem("Tab 3")GUICtrlCreateTabItem("")GUISetState(); Just idle aroundWhile 1 Sleep(10)WEndFunc SpecialEvents() Select Case @GUI_CTRLID = $GUI_EVENT_CLOSE MsgBox(0, "Close Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Exit Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE MsgBox(0, "Window Minimized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Case @GUI_CTRLID = $GUI_EVENT_RESTORE MsgBox(0, "Window Restored", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) EndSelect EndFunc ;==>SpecialEventsFunc _TabIt() Select Case GUICtrlRead($TAB) = 0 MsgBox(0, "Tab", "1st Tab Selected") Case GUICtrlRead($TAB) = 1 MsgBox(0, "Tab", "2nd Tab Selected") Case GUICtrlRead($TAB) = 2 MsgBox(0, "Tab", "3rd Tab Selected") EndSelectEndFunc ;==>_TabItnice job... gafrostyour the expert on these for sureyou found how to post and still view the spacing, however when i copied and pasted to my Scite... it was all on one line8) Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted September 23, 2005 Share Posted September 23, 2005 nice job... gafrostyour the expert on these for sureyou found how to post and still view the spacing, however when i copied and pasted to my Scite... it was all on one line8)Replay on his post, and copy the code from in there.. Link to comment Share on other sites More sharing options...
ligenza Posted September 29, 2005 Share Posted September 29, 2005 (edited) You mean something like this?CODE#include <GuiConstants.au3>opt("GUIOnEventMode", 1)GUICreate("MyGUI", 392, 323)GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")$TAB = GUICtrlCreateTab(10, 10, 200, 200)GUICtrlSetOnEvent($TAB, "_TabIt")$tab_item1 = GUICtrlCreateTabItem("Tab 1")GUICtrlCreateTabItem("")$tab_item2 = GUICtrlCreateTabItem("Tab 2")GUICtrlCreateTabItem("")$tab_item3 = GUICtrlCreateTabItem("Tab 3")GUICtrlCreateTabItem("")GUISetState(); Just idle aroundWhile 1 Sleep(10)WEndFunc SpecialEvents() Select Case @GUI_CTRLID = $GUI_EVENT_CLOSE MsgBox(0, "Close Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Exit Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE MsgBox(0, "Window Minimized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Case @GUI_CTRLID = $GUI_EVENT_RESTORE MsgBox(0, "Window Restored", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) EndSelect EndFunc ;==>SpecialEventsFunc _TabIt() Select Case GUICtrlRead($TAB) = 0 MsgBox(0, "Tab", "1st Tab Selected") Case GUICtrlRead($TAB) = 1 MsgBox(0, "Tab", "2nd Tab Selected") Case GUICtrlRead($TAB) = 2 MsgBox(0, "Tab", "3rd Tab Selected") EndSelectEndFunc ;==>_TabItI do not understand why your code is so bloated. What is wrong with doing it like this? CODE#include <GuiConstants.au3>GUICreate("Tab Test", 200, 200)$Tab = GUICtrlCreateTab(10, 10, 200, 200)$tab1 = GUICtrlCreateTabItem("0ne")$tab2 = GUICtrlCreateTabItem("Two")GUISetState()While 1 $msg = GUIGetMsg() Select Case $msg = $Tab detectTab() Case $msg = $GUI_EVENT_CLOSE Exit EndSelectWEndFunc detectTab() $tn = GUICtrlRead($Tab) + 1 MsgBox(0, "Tab #" & $tn, "Tab " & $tn & " selected!")EndFuncTo copy my code with the formating just quote me then c&p what's in the quote part when you reply. Both the code and codebox tag seems to strip all of my formatting work but it's there if you quote in a reply for some odd reason.Have variables in AutoIt always not been case sensitive? Edited September 29, 2005 by ligenza Link to comment Share on other sites More sharing options...
GaryFrost Posted September 29, 2005 Share Posted September 29, 2005 I do not understand why your code is so bloated. What is wrong with doing it like this? CODE#include <GuiConstants.au3>GUICreate("Tab Test", 200, 200)$Tab = GUICtrlCreateTab(10, 10, 200, 200)$tab1 = GUICtrlCreateTabItem("0ne")$tab2 = GUICtrlCreateTabItem("Two")GUISetState()While 1$msg = GUIGetMsg()SelectCase $msg = $TabdetectTab()Case $msg = $GUI_EVENT_CLOSEExitEndSelectWEndFunc detectTab()$tn = GUICtrlRead($Tab) + 1MsgBox(0, "Tab #" & $tn, "Tab " & $tn & " selected!")EndFuncTo copy my code with the formating just quote me then c&p what's in the quote part when you reply. Both the code and codebox tag seems to strip all of my formatting work but it's there if you quote in a reply for some odd reason.Have variables in AutoIt always not been case sensitive? I would rather have it bloated than completely wrong.HoochPosted Sep 22 2005, 05:19 PM I have a set of three tabs and I want to hide/unhide 3rd party windows depending on which tab is accessed. I tried guionevent mode, it works when I use a button but not when I tried it with the tab.Suggestions? SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
ligenza Posted September 29, 2005 Share Posted September 29, 2005 (edited) I would rather have it bloated than completely wrong. My code was directed at you, not the origonal poster. It is not wrong. "I tried guionevent mode, it works when I use a button but not when I tried it with the tab." is what the origonal poster said. My example showed how to make it work with guionevent mode. You can't read very well... I'd offer for you to join the online course I'm instructing but I don't think I want you as my student. Apparently you are not bright enough to adapt it either. Allow me:CODE#include <GuiConstants.au3>opt("GUIOnEventMode", 1)GUICreate("Tab Test", 200, 200)GUISetOnEvent($GUI_EVENT_CLOSE, "quit")$Tab = GUICtrlCreateTab(10, 10, 200, 200)GUICtrlSetOnEvent($Tab, "detectTab")$tab1 = GUICtrlCreateTabItem("0ne")$tab2 = GUICtrlCreateTabItem("Two")GUISetState()While 1WEndFunc detectTab() $tn = GUICtrlRead($Tab) + 1 MsgBox(0, "Tab #" & $tn, "Tab " & $tn & " selected!")EndFuncFunc quit()If @GUI_CTRLID = $GUI_EVENT_CLOSE Then ExitEndFuncI see a very poor coder post an answer that is really not a good solution so I post an alternative version of the code asking for clarification and what I get in responce is a flame. How ironic. It's people like you that make this forum so much fun. Edited September 29, 2005 by ligenza Link to comment Share on other sites More sharing options...
GaryFrost Posted September 29, 2005 Share Posted September 29, 2005 If your about done, your original post had no guionevent, I know how to adapt it, the user asking the question may not know how to adapt it, and think before you call me a very poor coder and that I can't read very well, should look at the approximately 200 or more UDF's I've created for the beta, I'm sure you can do better on all of them. Gary SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Hooch Posted September 29, 2005 Author Share Posted September 29, 2005 AH the LOVE! Anyways guys, I am using this... Func _TabIt() Select Case GUICtrlRead($tabs) = 0 showDaily() Case GUICtrlRead($tabs) = 1 showWeekly() Case GUICtrlRead($tabs) = 2 showDeploy() EndSelect EndFunc with... $tabs=GUICtrlCreateTab (0,0, 500,100, $TCS_BOTTOM) GUICtrlSetOnEvent($tabs, "_TabIt") ...and it is working perfectly. Thanks for the help I really appreciate it Link to comment Share on other sites More sharing options...
ligenza Posted September 29, 2005 Share Posted September 29, 2005 If your about done, your original post had no guionevent, I know how to adapt it, the user asking the question may not know how to adapt it, and think before you call me a very poor coder and that I can't read very well, should look at the approximately 200 or more UDF's I've created for the beta, I'm sure you can do better on all of them.GaryMy code was not directed at the origional poster as I have said. Other people read this forum so I made a gui message tab system so people could see both ways. You know how to flame, that's about it. I provided a better version of your code as proven by your flame and no intelligent comments.. You are, by definition, a very poor coder and judging by this thread I'm amazed you can read at all! You should look at my paycheck from the code contributions I've given to my company, well in excess of 200. I know I can do better than all of your functions. I've spent the last week reporting your stupid mistakes in them. Link to comment Share on other sites More sharing options...
ligenza Posted September 29, 2005 Share Posted September 29, 2005 (edited) AH the LOVE!Anyways guys, I am using this...Func _TabIt() Select Case GUICtrlRead($tabs) = 0 showDaily() Case GUICtrlRead($tabs) = 1 showWeekly() Case GUICtrlRead($tabs) = 2 showDeploy() EndSelect EndFuncwith...$tabs=GUICtrlCreateTab (0,0, 500,100, $TCS_BOTTOM) GUICtrlSetOnEvent($tabs, "_TabIt")...and it is working perfectly. Thanks for the help I really appreciate it Something like $n = GUICtrlRead($tabs) + 1 Select Case $n = 1 showDaily() Case $n = 2 showWeekly() Case $n = 3 showDeploy() EndSelectwould work better in my opinion as you're only pulling data from the controle once and the numbers in the case statement reflect their respective tab and as a bonus it's a lot less to type! Edited September 29, 2005 by ligenza Link to comment Share on other sites More sharing options...
Hooch Posted September 29, 2005 Author Share Posted September 29, 2005 Ah right you are, this also works perfectly and is a tad more efficient. Thanks much. Link to comment Share on other sites More sharing options...
ligenza Posted September 29, 2005 Share Posted September 29, 2005 Ah right you are, this also works perfectly and is a tad more efficient. Thanks much.You're welcome. Link to comment Share on other sites More sharing options...
Hooch Posted September 29, 2005 Author Share Posted September 29, 2005 I did notice the multiple calls to the control for the data but I wasn't going to worry about it yet. I am hammering out the app and I always end up "refactoring" my code many many times before I am happy with it. It is easy to get sloppy Having said that I had no idea the tabs generated an event at all so I was very happy to just be able to pull it off at all Link to comment Share on other sites More sharing options...
GaryFrost Posted September 29, 2005 Share Posted September 29, 2005 (edited) My code was not directed at the origional poster as I have said. Other people read this forum so I made a gui message tab system so people could see both ways. You know how to flame, that's about it. I provided a better version of your code as proven by your flame and no intelligent comments.. You are, by definition, a very poor coder and judging by this thread I'm amazed you can read at all! You should look at my paycheck from the code contributions I've given to my company, well in excess of 200. I know I can do better than all of your functions. I've spent the last week reporting your stupid mistakes in them. Expect what you giveI do not understand why your code is so bloated. What is wrong with doing it like this?Out of all my posts only a few have been flames.I'll admit I make mistakes, even after 16 years of programming experience I'm not afraid to admit to mistakes, and also not afraid to ask for help when needed.You pointed out mistakes, but did you offer the solutions to any?My paycheck is nothing to snicker at either. Edited September 29, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
ligenza Posted September 29, 2005 Share Posted September 29, 2005 (edited) Expect what you giveOut of all my posts only a few have been flames.I'll admit I make mistakes, even after 16 years of programming experience I'm not afraid to admit to mistakes, and also not afraid to ask for help when needed.You pointed out mistakes, but did you offer the solutions to any?My paycheck is nothing to snicker at either.We all make mistakes, your point? I offered a non-bloated version after pointing out your stupidity. It makes me wonder with all your free time and 200 UDFs devoted to boosting your ego. Edited September 29, 2005 by ligenza Link to comment Share on other sites More sharing options...
Developers Jos Posted September 29, 2005 Developers Share Posted September 29, 2005 (edited) My code was not directed at the origional poster as I have said. Other people read this forum so I made a gui message tab system so people could see both ways. You know how to flame, that's about it. I provided a better version of your code as proven by your flame and no intelligent comments.. You are, by definition, a very poor coder and judging by this thread I'm amazed you can read at all! You should look at my paycheck from the code contributions I've given to my company, well in excess of 200. I know I can do better than all of your functions. I've spent the last week reporting your stupid mistakes in them.We all make mistakes, your point? I offered a non-bloated version after pointing out your stupidity. It makes me wonder with all your free time and 200 UDFs devoted to boosting your ego.Don't understand why this is needed... Gary has given his opinion like you did so why resort to this type of BS when you don't agree with his statements? Gary has coded a lot of GUI UDF's and has made a BIG contribution to the AutoIt community by doing this. It is obvious that there will be bugs in there and they will be fixed whenever reported.Its kind of cheap to shoot at somebody who shares so much code by making a comment that YOU are finding his stupid mistakes .... Respect.. Edited September 29, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Josbe Posted September 29, 2005 Share Posted September 29, 2005 Don't understand why this is needed... Gary has given his opinion like you did so why resort to this type of BS when you don't agree with his statements? Gary has coded a lot of GUI UDF's and has made a BIG contribution to the AutoIt community by doing this. It is obvious that there will be bugs in there and the will be fixed whenever reported.Its kind of cheap to shoot at somebody who shares so much code by making a comment that YOU are finding his stupid mistakes .... Respect..I support this comment.Yeah, it is a forum, but it would not have to be used to be making this kind of judgments with the people who make their great contribution in the AutoIt community. If this is personal issue, or it's not in agreement with some things, just use the PM(Private Message) way. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
Valik Posted September 29, 2005 Share Posted September 29, 2005 If this is personal issue, or it's not in agreement with some things, just use the PM(Private Message) way. No, no! Keep it public. I sometimes enjoy watching battles I'm not a part of/didn't start. 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