careca Posted March 27, 2013 Share Posted March 27, 2013 Hey there! got a script with 5 buttons and only one works, the first one can be clicked if clicked on the upper border! :S expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=BPlayer.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Comment=By: Careca #AutoIt3Wrapper_Res_Description= #AutoIt3Wrapper_Res_Fileversion=1.3 #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Icon_Add=BPlayer.ico #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #AutoIt3Wrapper_Run_Tidy=y #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.1 Author: Careca Script: Version: #ce ---------------------------------------------------------------------------- ;DirCreate(@ScriptDir & '\folder') ;FileInstall("ico.ico", @ScriptDir & "\folder\ico.ico") ;#include <GuiButton.au3> ;#include <Constants.au3> ;#include <GUIConstants.au3> #include <GUIConstantsEx.au3> Opt("TrayMenuMode", 1) Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Opt("GUIEventOptions", 1) Opt("TrayOnEventMode", 1) ;Gui Local $GUI, $Button_1, $Button_2, $Button_3, $Button_4, $Button_5, $ExitItem Local $Input_1, $Input_2, $Input_3, $Input_4, $Label1, $Label2, $Label3, $Label4 ;Vars Local $RInput_1, $RInput_2, $RInput_3, $RInput_4, $Result TraySetIcon("ico.ico") $GUI = GUICreate("Ohm's Law Calculator", 200, 200, 100, 100) GUISetIcon(@ScriptDir & "\ico.ico", -1) $Input_1 = GUICtrlCreateInput("", 10, 10, 70, 20) $Input_2 = GUICtrlCreateInput("", 10, 40, 70, 20) $Input_3 = GUICtrlCreateInput("", 10, 70, 70, 20) $Input_4 = GUICtrlCreateInput("", 10, 100, 70, 20) $Label1 = GUICtrlCreateLabel('Ohm', 85, 13, 345, 30) $Label2 = GUICtrlCreateLabel('Volt', 85, 43, 345, 30) $Label3 = GUICtrlCreateLabel('Amp', 85, 73, 345, 30) $Label4 = GUICtrlCreateLabel('Watt', 85, 103, 345, 30) $Button_1 = GUICtrlCreateButton("Calculate", 10, 130, 60) GUICtrlSetOnEvent(-1, "Calculate") $Button_2 = GUICtrlCreateButton("Clear", 110, 10, 40, 20) GUICtrlSetOnEvent(-1, "ClearO") $Button_3 = GUICtrlCreateButton("Clear", 110, 40, 40, 20) GUICtrlSetOnEvent(-1, "ClearV") $Button_4 = GUICtrlCreateButton("Clear", 110, 70, 40, 20) GUICtrlSetOnEvent(-1, "ClearI") $Button_5 = GUICtrlCreateButton("Clear", 110, 100, 40, 20) GUICtrlSetOnEvent(-1, "ClearW") $ExitItem = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "Quit") GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Restore") GUISetState() TraySetState(1) TraySetClick(8) ;============================================================================= Func Calculate() $RInput_1 = GUICtrlRead($Input_1) If $RInput_1 = '' Then $RInput_2 = GUICtrlRead($Input_2) $RInput_3 = GUICtrlRead($Input_3) $Result = ($RInput_2 / $RInput_3) GUICtrlSetData($Input_1, $Result) EndIf $RInput_2 = GUICtrlRead($Input_2) If $RInput_2 = '' Then $RInput_1 = GUICtrlRead($Input_1) $RInput_3 = GUICtrlRead($Input_3) $Result = ($RInput_1 * $RInput_3) GUICtrlSetData($Input_2, $Result) EndIf $RInput_3 = GUICtrlRead($Input_3) If $RInput_3 = '' Then $RInput_1 = GUICtrlRead($Input_1) $RInput_2 = GUICtrlRead($Input_2) $Result = ($RInput_2 / $RInput_1) GUICtrlSetData($Input_3, $Result) EndIf $RInput_4 = GUICtrlRead($Input_4) If $RInput_4 = '' Then $RInput_1 = GUICtrlRead($Input_1) $RInput_3 = GUICtrlRead($Input_3) $Result = ($RInput_1 * $RInput_3) GUICtrlSetData($Input_4, $Result) EndIf EndFunc ;==>Calculate ;============================================================================= Func ClearO() GUICtrlSetData($Input_1, '') EndFunc ;==>ClearO Func ClearV() GUICtrlSetData($Input_2, '') EndFunc ;==>ClearV Func ClearI() GUICtrlSetData($Input_3, '') EndFunc ;==>ClearI Func ClearW() GUICtrlSetData($Input_4, '') EndFunc ;==>ClearW ;============================================================================= ;Window Actions Func Minimize() WinSetState('', '', @SW_MINIMIZE) EndFunc ;==>Minimize Func Restore() WinSetState('', '', @SW_RESTORE) EndFunc ;==>Restore Func Quit() Exit EndFunc ;==>Quit ;============================================================================= Do Sleep(25) ;ToolTip($RInput_1 & ' ' & $RInput_2 & ' ' & $RInput_3 & ' ' & $Result) Until GUIGetMsg() = $GUI_EVENT_CLOSE ;============================================================================= Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 27, 2013 Moderators Share Posted March 27, 2013 careca,Your labels are too big and overlap the buttons - when this happens with 2 controls that fire events AutoIt refuses to honour either as it cannot tell which one the user meant to action. Use GUICtrlSetBackColor to colour the labels and you will soon see what I mean. Just reduce their size so there is no overlap and your buttons will work. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
careca Posted March 27, 2013 Author Share Posted March 27, 2013 Owwwhh, damn, cannot believe how i could not see that! thank you! I was messing with theOpt("GUIEventOptions", 1)those options, checked it all, and couldn't get why the buttons weren't being clicked. :S Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe 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