ken82m Posted May 16, 2004 Share Posted May 16, 2004 (edited) okay i'm writing my script around exmaple two under GUIMSG in the help file shown here. expandcollapse popup;------------------------------------------------------------------------------------- ; example2 for a very advanced using GUIMsg(0) $title="My advanced GUI" GUICreate($title); will create a dialog box that when displayed is centered GUISetControl("button", "my clicking button", 10,10) GUISetControlNotify() GUISetControl("button", "my closing button", 10,50) GUISetControlEx(-1,$GUI_FOCUS) ; the focus is on this button and Click will hide the GUI GUIShow(10) ; display the dialog box timeout 10 seconds AdLibEnable("CheckChange") WinWaitClose($title) ; GuiWaitClose cannot be used to wait AdlibDisable() exit Func CheckChange () $n = GUIMsg(0) ; get the current state and return immediately Select case $n>0 MsgBox(0,"", "the button " & GUIRead() & " has been clicked",2) Case $n=-1 MsgBox(0,"", "dialog box being closed by timeout",2) exit ; or GuiDelete to stop the waiting WinWaitClose case $n=-2 MsgBox(0,"", "dialog box is hidden",2) GuiDelete() ; will stop the waiting of WinWaitClose and close the script case $n=-3 MsgBox(0,"", "dialog box being closed by red button",2) exit ; or GuiDelete to stop the waiting WinWaitClose case $n=-4 MsgBox(0,"", "dialog box minimized",2) case $n=-5 MsgBox(0,"", "dialog box restaured",2) case $n=-6 MsgBox(0,"", "dialog box maximize",2) case $n=0 ; no change case else MsgBox(0,"", "unknown return from GUIMsg",2) EndSelect EndFunc Here is what I have put together so far: expandcollapse popup#include "C:\Program Files\AutoIt3\Include\GuiConstants.au3" Opt("GUICoordMode",2) Opt("GUINotifyMode",1) $title="IT God Console" GUICreate($title, 640, 480); will create a dialog box that when displayed is centered $1 = GuiSetControl("radio", "Computer Name", 60, 5, 100) ; first cell 60 width $text1 = GuiSetControl("input", "", 0, -1, 250) ; next line $2 = GuiSetControl("radio", "Local Computer", 50, -1) ; next line and next cell GUISetControlEx(-1,$GUI_FOCUS) ; the focus is on this button and Click will hide the GUI GUIShow() ; display the dialog box timeout 10 seconds AdLibEnable("CheckChange") WinWaitClose($title) ; GuiWaitClose cannot be used to wait AdlibDisable() exit Func CheckChange () $n = GUIMsg(0) ; get the current state and return immediately Select case $n>0 MsgBox(0,"", "the button " & GUIRead() & " has been clicked",2) Case $n=-1 MsgBox(0,"", "dialog box being closed by timeout",2) exit ; or GuiDelete to stop the waiting WinWaitClose case $n=-2 MsgBox(0,"", "dialog box is hidden",2) GuiDelete() ; will stop the waiting of WinWaitClose and close the script case $n=-3 MsgBox(0,"", "dialog box being closed by red button",2) exit ; or GuiDelete to stop the waiting WinWaitClose case $n=-4 MsgBox(0,"", "dialog box minimized",2) case $n=-5 MsgBox(0,"", "dialog box restaured",2) case $n=-6 MsgBox(0,"", "dialog box maximize",2) case $n=0 ; no change case else MsgBox(0,"", "unknown return from GUIMsg",2) EndSelect If GuiRead($1) = 1 Then GUISetControlEx($text1, 64) GUISetControlEx($2, 4) EndIf If GuiRead($2) = 1 Then GUISetControlEx($1, 4) GUISetControlEx($text1, 128) EndIf EndFunc 1) My main problem is with the text box "$text1" as soon as I start typing in it the windows "refreshes" or "checks for changes" how can I make this text box usable. 2) Using this statement: If GuiRead($2) = 1 Then GUISetControlEx($1, 4) GUISetControlEx($text1, 128) EndIf How can I also make $text1 null I tried GuiWrite($text1, , "") Thanks again, Kenny Edited October 10, 2008 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
Valik Posted May 16, 2004 Share Posted May 16, 2004 You are ALWAYS reading the state of the buttons EVERY time the AdLib function is called. This means that when the button (Either one) is checked, it will always be = 1 when you use GuiRead(). I don't know exactly what you are going for with that GUI, but you definitely can't read the state of those radio buttons every time the AdLib callback is run. As for the second question, it should be GuiWrite($text1, 0, ""). You can't skip a parameter by leaving it empty. Most of the time, a numeric argument can accept -1 or 0 to "use default" and a string argument takes "". The correct default parameter is usually in the Remarks section for each of the functions. Link to comment Share on other sites More sharing options...
ken82m Posted May 16, 2004 Author Share Posted May 16, 2004 well these two radio buttons and text box will be the key to the whole window depending on which one is selected it may or may not disable many other functions in the window. (when I figure them out) lol I don't know....... my first real GUI lol I'm just trying to find the proper way to loop it and this example seemed to work. "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
CyberSlug Posted May 16, 2004 Share Posted May 16, 2004 (edited) notification with edit/input boxes is buggy...GuiWrite($text1, 0, "") ;should clear the input boxHere's a bit of a different approach. Maybe it might help?expandcollapse popup;Script generated by AutoBuilder 0.4 - but modified Global $GUI_CHECKED = 1 Global $EM_SETSEL = 0xB1 Global $winTitle = "MyGUI Console" Opt("GUICoordMode", 1) Opt("GUINotifyMode", 1) GuiCreate($winTitle, 400,300,(@DesktopHeight-400)/2, (@DesktopHeight-300)/2 , 0x04CF0000) $radio_1 = GUISetControl("radio", "Radio 1", 10, 10, 80, 20) GUISetControlEx($radio_1, $GUI_CHECKED) $input_1 = GUISetControl("input", "Input 1", 100, 10, 170, 20) $radio_2 = GUISetControl("radio", "Radio 2", 280, 10, 100, 20) GuiShow() WinActivate($winTitle) While 1 sleep(100);prevent maxing-out the CPU $msg = GuiMsg(0) Select Case $msg = -3;close button 'x' in corner Exit Case $msg = $radio_1 ControlFocus($winTitle,"","Edit1") ; hackish way to give the input box focus ; you really shouldn't mix gui refs with controlcommands.... Case $msg = $input_1 ;;; Case $msg = $radio_2 GuiWrite($input_1, 0, "");clear input box EndSelect WEnd Exit ; Other useful stuff ;;; GuiSendMsg($TypeRef,$EM_SETSEL,0,99999);Select practically all in textbox Edited May 16, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Valik Posted May 16, 2004 Share Posted May 16, 2004 It's not necessary to poll the state of those buttons. When they are clicked, they will generate a message your loop will get. That is the time to hide or show controls. Polling should only be done on specific events, not every time through the loop. Link to comment Share on other sites More sharing options...
ken82m Posted May 16, 2004 Author Share Posted May 16, 2004 (edited) Much better thanks guys Now I'll just see if I can destroy your work when I add the other functions But with this first part one the rest should be a breeze, I hope Thanks again, Kenny Edited May 16, 2004 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now