SlowCoder74 Posted May 24, 2012 Share Posted May 24, 2012 I know that some objects, like buttons, act like onclick events. But what about labels or input boxes? I've tried using Opt("GUIOnEventMode", 1) and setting GUICtrlSetOnEvent, but things like input boxes don't trigger until the box is unfocussed, so the event is really an onchange type of event. Link to comment Share on other sites More sharing options...
Mechaflash Posted May 24, 2012 Share Posted May 24, 2012 In your While loop, you can intermittently check for changes to your input box via GUICtrlRead() and it can act like a "onchange" event. Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
Mechaflash Posted May 24, 2012 Share Posted May 24, 2012 (edited) hehe I made a pretty nice example here #include #include #include #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 211, 55, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 24, 16, 161, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $x = 0 $InitialRead = 0 While 1 $x+=1 If $InitialRead = 0 Then $sInitialInput = GUICtrlRead($Input1) $InitialRead = 1 EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Input1 EndSwitch _Change() WEnd Func _Change() If $x = 10001 Then $x = 0 If IsInt($x/100) Then If $sInitialInput <> GUICtrlRead($Input1) Then msgbox(0,"","CHANGED") $InitialRead = 0 EndIf EndIf EndFunc Edited May 25, 2012 by mechaflash213 Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
Zedna Posted May 24, 2012 Share Posted May 24, 2012 (edited) Elegant way, forget about mechaflash213 :-) #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $Form1 = GUICreate("Test", 349, 184, 192, 124) $Input1 = GUICtrlCreateInput("", 40, 24, 161, 21) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func WM_COMMAND($hWinHandle, $iMsg, $wParam, $lParam) If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $Input1 Then ConsoleWrite('Edit changed: ' & GUICtrlRead($Input1) & @CRLF) EndIf EndFunc ;==>WM_COMMAND Edited May 24, 2012 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Mechaflash Posted May 24, 2012 Share Posted May 24, 2012 @Zedna =P I'm not too hip with the WinAPI functions yet =( Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
Zedna Posted May 24, 2012 Share Posted May 24, 2012 (edited) @Zedna =P I'm not too hip with the WinAPI functions yet =(That's OKbut you should answer/replay to questions only if you know answer.Posting such shit code is not good.EDIT: If you are beginner then don't try to be smart, instead just read/listen and learn from it/others Edited May 24, 2012 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Mechaflash Posted May 25, 2012 Share Posted May 25, 2012 Sorry for the shit code... Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
SlowCoder74 Posted May 28, 2012 Author Share Posted May 28, 2012 I understand about checking for a change in an input object. But I'm not looking for a change in the object's value/data. I'd really like to just be able to click on a label or input object and pop up a box/dialog, whatever. For instance, a label that displays a date. Click on it, and it pops up a calendar to select a new date. Is that possible? Link to comment Share on other sites More sharing options...
JohnOne Posted May 28, 2012 Share Posted May 28, 2012 Input boxes do not, but labels work just the same as buttons. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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