Jump to content

Recommended Posts

Posted

Dear all,

I want to create a GUI - from the GUI you select what prinetr you want to install and press the install button and the printer is instaled.

I want to create a cancel button - buty after two days I am no further in getting it o work.

Below is the script I created so far - the problem is that when you press the cancel it shoudl close the GUI but is does not doe anything.

-----------------------------------------------------------------------------------------------

#include <GUIConstants.au3>

WinClose ("Printer Installation"); closed any open window

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode 
$mainwindow = GUICreate("Printer Installation Menu", 300, 100)
    GUISetOnEvent ($GUI_EVENT_CLOSE, "closemainwindow")

GUICtrlCreateGroup ("Choose Printer To Install", 30, 5, 150, 43)

;$printer_01 = GUICtrlCreateCombo ("", 30, 20, 140, 20, "$CBS_DROPDOWN", "")
    GUICtrlCreateCombo ("B2_FL4_BW2", 35,20,140, 20); create first item
    GUICtrlSetData(-1,"Printer_02|Printer_03|Printer_04","B2_FL4_BW2"); add other item and set a new default

GUICtrlCreateGroup ("",-99,-99,1,1)

   $installbutton = GUICtrlCreateButton ("Install", 35, 55, 60)

   $cancelbutton = GUICtrlCreateButton ("Cancel", 115, 55, 60)
    GUISetOnEvent ($cancelbutton, "cancelbuttonpressed")

GUISetState(@SW_SHOW)

While 1
  Sleep(10) ; Idle around
WEnd

;-------------------Start of all Functions---------------------------------

Func closemainwindow()
    Exit
EndFunc

--

Func cancelbuttonpressed()
    WinClose ("Printer Installation Menu")
EndFunc
Posted

Two things come to mind.

1. The title you are using is wrong.

2. Try using WinKill() instead of WinClose().

<{POST_SNAPBACK}>

What is wrong with the title ?
Posted

GUISetOnEvent ($cancelbutton, "cancelbuttonpressed")

should be

    GUICtrlSetOnEvent ($cancelbutton, "cancelbuttonpressed")

<{POST_SNAPBACK}>

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
×
×
  • Create New...