Jump to content
Sign in to follow this  
Fossil Rock

GUICtrlCreateGroup question

Recommended Posts

Fossil Rock

Can a group be hidden all at once or do I have to stick with hiding each control individually?


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites
therks

Individually. Want to see a trick I use though?

There are lots of ways to hide groups of controls, but this one is one of my favorites lately.

Note: This will only work for controls that are all created one after the other.

#include <GUIConstants.au3>

$gui = GUICreate('', 200, 200)
$dm_Start = GUICtrlCreateDummy()
GUICtrlCreateButton('', 0, 0, 100, 20)
GUICtrlCreateButton('', 0, 20, 100, 20)
GUICtrlCreateButton('', 0, 40, 100, 20)
GUICtrlCreateButton('', 0, 60, 100, 20)
GUICtrlCreateButton('', 0, 80, 100, 20)
GUICtrlCreateInput('', 0, 100, 100, 20)
GUICtrlCreateInput('', 0, 120, 100, 20)
GUICtrlCreateInput('', 0, 140, 100, 20)
GUICtrlCreateInput('', 0, 160, 100, 20)
GUICtrlCreateInput('', 0, 180, 100, 20)
$dm_End = GUICtrlCreateDummy()
GUISetState()

Sleep(1000)

For $iCtrl = $dm_Start to $dm_End
    GUICtrlSetState($iCtrl, $GUI_HIDE)
Next

Sleep(1000)

For $iCtrl = $dm_Start to $dm_End
    GUICtrlSetState($iCtrl, $GUI_SHOW)
Next

While 1
    $gm = GUIGetMsg()
    Switch $gm
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
Edited by Saunders

Share this post


Link to post
Share on other sites
Fossil Rock

Interesting ... thanks.


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites
Monamo

Individually. Want to see a trick I use though?

There are lots of ways to hide groups of controls, but this one is one of my favorites lately.

Note: This will only work for controls that are all created one after the other.

#include <GUIConstants.au3>[color="#0000FF"][/color]

$gui = GUICreate('', 200, 200)
$dm_Start = GUICtrlCreateDummy()
GUICtrlCreateButton('', 0, 0, 100, 20)
GUICtrlCreateButton('', 0, 20, 100, 20)
GUICtrlCreateButton('', 0, 40, 100, 20)
GUICtrlCreateButton('', 0, 60, 100, 20)
GUICtrlCreateButton('', 0, 80, 100, 20)
GUICtrlCreateInput('', 0, 100, 100, 20)
GUICtrlCreateInput('', 0, 120, 100, 20)
GUICtrlCreateInput('', 0, 140, 100, 20)
GUICtrlCreateInput('', 0, 160, 100, 20)
GUICtrlCreateInput('', 0, 180, 100, 20)
$dm_End = GUICtrlCreateDummy()
GUISetState()

Sleep(1000)

For $iCtrl = $dm_Start to $dm_End
    GUICtrlSetState($iCtrl, $GUI_HIDE)
Next

Sleep(1000)

For $iCtrl = $dm_Start to $dm_End
    GUICtrlSetState($iCtrl, $GUI_SHOW)
Next

While 1
    $gm = GUIGetMsg()
    Switch $gm
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Fantastic! :) I wish I'd thought of that! I typically went through the tedium of building an array list of items in a group and then For...Next'd 'em off and on.


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites
therks

That's the way I used to do it, and it's still the best way if you have a group of items that aren't all in a row (or get deleted and regenerated).

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.