Sign in to follow this  
Followers 0
soyfelix

[b]Refresh to default values! HEEEELLPPPP![/b]

7 posts in this topic

Hello, Excume for my english, but ill try. s

I need to refresh to default values the following controls:

GUICtrlCreateCombo

GUICtrlCreateInput

GUICtrlCreateDate

I have made severals GUI with 80 o 90 of this controls, I have wrotten in them values like this:

$Combo1 = GUICtrlCreateCombo("", 120, 80, 249, 25)

GUICtrlSetData(-1, "Si|No", "No")

$Input1 = GUICtrlCreateInput("", 120, 120, 249, 21)

$Date1 = GUICtrlCreateDate("9999/12/31 12:27:25", 120, 160, 257, 33)

When the user fill this controls i hide the gui, and then when the user show the same gui, the controls have the old values. I know this way to set values into the controls:

GUICtrlSetData(Combo1 , "Si|No", "No")

GUICtrlSetData(Input1 , "")

GUICtrlSetData(Date1 , "9999/12/31")

but i have a loooootttt ooooffff controls like this and its very hard to code for me.

Is there any way to set the default value for this controls?? is that the only way???

Thanksss!!!!

Share this post


Link to post
Share on other sites



See an example here:

#482000

Share this post


Link to post
Share on other sites

One of the variants:

#include <GuiConstants.au3>

Global $Default = "No"

$hGui = GUICreate("Test GUI", 300, 200)

$hStartDummy = GUICtrlCreateDummy()
GUICtrlCreateInput("", 10, 10, 200, 20)

GUICtrlCreateCombo("", 10, 40, 200, 20)

GUICtrlCreateInput("", 10, 70, 200, 20)

GUICtrlCreateCombo("", 10, 100, 200, 20)
$hEndDummy = GUICtrlCreateDummy()

$RefreshButton = GUICtrlCreateButton("Refresh", 10, 170, 60, 25)

GUISetState()

While 1
    $msg = GUIGetMsg()
    
    Switch $msg
    Case - 3
        ExitLoop
    Case $RefreshButton
        For $i = $hStartDummy To $hEndDummy
            GUICtrlSetData($i, "")
            GUICtrlSetData($i, $Default, $Default)
        Next
    EndSwitch
WEnd
:)

Share this post


Link to post
Share on other sites

One of the variants:

#include <GuiConstants.au3>

Global $Default = "No"

$hGui = GUICreate("Test GUI", 300, 200)

$hStartDummy = GUICtrlCreateDummy()
GUICtrlCreateInput("", 10, 10, 200, 20)

GUICtrlCreateCombo("", 10, 40, 200, 20)

GUICtrlCreateInput("", 10, 70, 200, 20)

GUICtrlCreateCombo("", 10, 100, 200, 20)
$hEndDummy = GUICtrlCreateDummy()

$RefreshButton = GUICtrlCreateButton("Refresh", 10, 170, 60, 25)

GUISetState()

While 1
    $msg = GUIGetMsg()
    
    Switch $msg
    Case - 3
        ExitLoop
    Case $RefreshButton
        For $i = $hStartDummy To $hEndDummy
            GUICtrlSetData($i, "")
            GUICtrlSetData($i, $Default, $Default)
        Next
    EndSwitch
WEnd
:)

Thak you very much, but what can i differentiate between combo, input or date into the loop "for", because $i is a number???

Thanks!!!!!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

rasim teaches us the use of GUICtrlCreateDummy in his script but this isn't the usual way of referencing controls in your GUI.

Instead, the functions "GUICtrlCreateCombo" and "GUICtrlCreateInput", etc., return control ID's that you can use.

Edited by Squirrely1

Das Häschen benutzt Radar

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