Sign in to follow this  
Followers 0
Hooch

Rephrase of question in support forum...

29 posts in this topic

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?

Share this post


Link to post
Share on other sites



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.

 

Share this post


Link to post
Share on other sites

Awesome, thanks man. I had a working version with guimsg but it just seems so "sloppy" compared to guioneventmode.

Thanks much ;)

Share this post


Link to post
Share on other sites

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

nice job... gafrost

your the expert on these for sure

you found how to post and still view the spacing, however when i copied and pasted to my Scite... it was all on one line

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

nice job... gafrost

your the expert on these for sure

you found how to post and still view the spacing, however when i copied and pasted to my Scite... it was all on one line

8)

Replay on his post, and copy the code from in there.. ;)

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 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

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()

Select

Case $msg = $Tab

detectTab()

Case $msg = $GUI_EVENT_CLOSE

Exit

EndSelect

WEnd

Func detectTab()

$tn = GUICtrlRead($Tab) + 1

MsgBox(0, "Tab #" & $tn, "Tab " & $tn & " selected!")

EndFunc

To 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 by ligenza

Share this post


Link to post
Share on other sites

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()

Select

Case $msg = $Tab

detectTab()

Case $msg = $GUI_EVENT_CLOSE

Exit

EndSelect

WEnd

Func detectTab()

$tn = GUICtrlRead($Tab) + 1

MsgBox(0, "Tab #" & $tn, "Tab " & $tn & " selected!")

EndFunc

To 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.

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 1

WEnd

Func detectTab()

$tn = GUICtrlRead($Tab) + 1

MsgBox(0, "Tab #" & $tn, "Tab " & $tn & " selected!")

EndFunc

Func quit()

If @GUI_CTRLID = $GUI_EVENT_CLOSE Then Exit

EndFunc

I 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 by ligenza

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

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 ;)

Share this post


Link to post
Share on other sites

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

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.

Share this post


Link to post
Share on other sites

#12 ·  Posted (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
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 ;)

Something like

$n = GUICtrlRead($tabs) + 1
    Select
        Case $n = 1
            showDaily()
        Case $n = 2
            showWeekly()
        Case $n = 3
            showDeploy()
    EndSelect

would 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 by ligenza

Share this post


Link to post
Share on other sites

Ah right you are, this also works perfectly and is a tad more efficient. Thanks much.

Share this post


Link to post
Share on other sites

Ah right you are, this also works perfectly and is a tad more efficient. Thanks much.

You're welcome. Posted Image ;)

Share this post


Link to post
Share on other sites

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 :P

Share this post


Link to post
Share on other sites

#16 ·  Posted (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 give

I 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 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.

 

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Expect what you give

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.

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 by ligenza

Share this post


Link to post
Share on other sites

#18 ·  Posted (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 by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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. ;)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0