Sign in to follow this  
Followers 0
shastri

newb: needs help with code.

3 posts in this topic

with guis, once you make a button how do you make a button perform a certain function

: im trying to make my code do this

Goto: http://www.bebo.com/c/apps/browse_apps?sort=ZA

Click text link : add to my applications

Uncheck Checkbox: Add a module to my profile

repeat process until add to my applications is gone then continue to other pages.

other source:

URL GOTO=http://www.bebo.com/c/apps/browse_apps?sort=ZA

TAG POS=1 TYPE=A ATTR=TXT:add<SP>to<SP>my<SP>applications

TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/c/apps/add_confirm ATTR=ID:AllowModuleInd CONTENT=NO

TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:/c/apps/add_confirm ATTR=NAME:Add&&VALUE:Add<SP>Application

Share this post


Link to post
Share on other sites

When you create a GUI or a button using the GUICreate... function it always returns a control ID. That's why you use variables.

$Button = GUICreateButton(...

When you like the button to do something, you put a Switch.

While 1
$gMsg = GUIGetMsg()
Switch $gMsg
    Case $Button
         ;code here executes when button is pressed
    Case $GUI_EVENT_CLOSE
         Exit ;exit if user exits GUI
EndSwitch
WEnd

Correct me if there's something wrong.


[center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Please post you code so somebody at least would be able to help...e.g. I use this GUI in my PostInstall.au3:

; Configure the GUI
$MainWindow = GUICreate("Network-Profiles", 300, 80)

; Create the apply button and the descriptive label
$ApplyButton = GUICtrlCreateButton("Apply", 190, 50, 100)
Opt("GUICoordMode", 1)
GUICtrlCreateLabel("Please choose a network profile: ", 10, 5)

; Read the running Settings
$s_current = IniRead($s_ini_file, "Settings", "Current", "")

; Create a list of the network-settings defined in the .ini file
$ComboBox = GUICtrlCreateCombo($s_ini_sections[2], 10, 25, 280)
For $i = 3 To $s_ini_sections[0]
    If $i < $s_ini_sections[0] Then
        GUICtrlSetData($ComboBox, $s_ini_sections[$i])
    Else
        ; Set the running settings as Default
        GUICtrlSetData($ComboBox, $s_ini_sections[$i], $s_current)
    EndIf
Next

; Show the GUI
GUISetState(@SW_SHOW)

; Wait for a button to be clicked and do...whatever you shall do
While 1
    Switch (GUIGetMsg())
        Case $GUI_EVENT_CLOSE
            CLOSEClicked()
        Case $ApplyButton
            _ApplyButton()
            ExitLoop ; this will get out of the loop
    EndSwitch
WEnd

Func _ApplyButton()
    Do.Something.In.Code
EndFunc     ;==>_ApplyButton

Func CLOSEClicked()
    Do.Something.In.Code
EndFunc     ;==>_ApplyButton

Maybe the Apply-Button can inspire you somehow...

Regards,

Chris

Edited by cherdeg

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