troglo Posted March 19, 2009 Share Posted March 19, 2009 I put a button over a progress bar. But when I click on the button I get a reaction only when I click on that area with no progress bar below it! Is this normal? What should I do in order to be able to click on the whole area of the button? Thank you for your help Troglo CODE#include <GUIConstantsEx.au3> #include <ProgressConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("TEST", 279, 130) GUISetOnEvent($GUI_EVENT_CLOSE, "AForm1Close") $percentMax = 50 $pbLeft = 8 $pbTop = 20 $pbWidth = 257 $pbHeigth = 30 Global $pb = GUICtrlCreateProgress($pbLeft, $pbTop, $pbWidth, $pbHeigth, $PBS_SMOOTH) $btnLimit = GUICtrlCreateButton("", $pbLeft + ($pbWidth * $percentMax / 100), $pbTop, 15, $pbHeigth * 2) GUICtrlSetOnEvent(-1, "Limit") GUICtrlSetBkColor($btnLimit, 0xff0000) ;red GUISetState(@SW_SHOW) While 1 For $i = 0 To 100 Step 5 GUICtrlSetData($pb, $i) GUICtrlSetPos($btnLimit, $pbLeft + ($pbWidth * $percentMax / 100), $pbTop) Sleep(100) Next WEnd ;======================================================= Func AForm1Close() Exit EndFunc ;==>AForm1Close ;======================================================= Func Limit() MsgBox(0, "", "button pressed", 1) EndFunc ;==>Limit ;======================================================= Link to comment Share on other sites More sharing options...
Authenticity Posted March 19, 2009 Share Posted March 19, 2009 $btnLimit = GUICtrlCreateButton("", $pbLeft + ($pbWidth * $percentMax / 100), $pbTop, 15, $pbHeigth * 2) Global $pb = GUICtrlCreateProgress($pbLeft, $pbTop, $pbWidth, $pbHeigth, $PBS_SMOOTH) GUICtrlSetOnEvent($btnLimit, "Limit") Create it first. Link to comment Share on other sites More sharing options...
troglo Posted March 19, 2009 Author Share Posted March 19, 2009 $btnLimit = GUICtrlCreateButton("", $pbLeft + ($pbWidth * $percentMax / 100), $pbTop, 15, $pbHeigth * 2) Global $pb = GUICtrlCreateProgress($pbLeft, $pbTop, $pbWidth, $pbHeigth, $PBS_SMOOTH) GUICtrlSetOnEvent($btnLimit, "Limit") Create it first. Thank you very much! Although it is not intuitive: I thought that the last created control will stay on top of all others and catch all clicks! Or if I delete the 2 instructions: GUICtrlSetBkColor($btnLimit, 0xff0000) ;red GUICtrlSetPos($btnLimit, $pbLeft + ($pbWidth * $percentMax / 100), $pbTop) I get a button hidden by the progress bar but nevertheless fully active! Troglo Link to comment Share on other sites More sharing options...
martin Posted March 19, 2009 Share Posted March 19, 2009 Thank you very much! Although it is not intuitive: I thought that the last created control will stay on top of all others and catch all clicks! Or if I delete the 2 instructions: GUICtrlSetBkColor($btnLimit, 0xff0000) ;red GUICtrlSetPos($btnLimit, $pbLeft + ($pbWidth * $percentMax / 100), $pbTop) I get a button hidden by the progress bar but nevertheless fully active! Troglo Maybe this would make more sense expandcollapse popup#include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <windowsconstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("TEST", 279, 130) GUISetOnEvent($GUI_EVENT_CLOSE, "AForm1Close") $percentMax = 50 $pbLeft = 8 $pbTop = 20 $pbWidth = 257 $pbHeigth = 30 $btnLimit = GUICtrlCreateButton("", $pbLeft + ($pbWidth * $percentMax / 100), $pbTop, 15, $pbHeigth * 2) GUICtrlSetOnEvent(-1, "Limit") Global $pb = GUICtrlCreateProgress($pbLeft, $pbTop, $pbWidth, $pbHeigth, BitOR($WS_CLIPSIBLINGS, $PBS_SMOOTH)) ;GUICtrlSetBkColor($btnLimit, 0xff0000);red <- line can be in or not, makes no difference GUISetState(@SW_SHOW) While 1 For $i = 0 To 100 Step 5 GUICtrlSetData($pb, $i) Sleep(100) Next WEnd ;======================================================= Func AForm1Close() Exit EndFunc ;==>AForm1Close ;======================================================= Func Limit() MsgBox(0, "", "button pressed", 1) EndFunc ;==>Limit ;======================================================= Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
troglo Posted March 19, 2009 Author Share Posted March 19, 2009 Just great! I thought that $WS_CLIPSIBLINGS would work with windows only and not with controls. In any case honestly I don't understand what this style really does. My mother tongue is not english and the description of this style is not clear at all to me. May be you could explain it in a simpler way? Troglo Link to comment Share on other sites More sharing options...
vixLT6B Posted March 19, 2009 Share Posted March 19, 2009 (edited) I am not sure, but look at this: [link removed] Edited March 19, 2009 by SmOke_N Link to comment Share on other sites More sharing options...
martin Posted March 20, 2009 Share Posted March 20, 2009 Just great!I thought that $WS_CLIPSIBLINGS would work with windows only and not with controls.In any case honestly I don't understand what this style really does.My mother tongue is not english and the description of this style is not clear at all to me.May be you could explain it in a simpler way?TrogloWell first of all controls are windows.What the style $WS_CLIPSIBLINGS does is to prevent the control or window being drawn over an area occupied by another, previously created, control or window which has the same parent window. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
fZkFUvA Posted March 20, 2009 Share Posted March 20, 2009 (edited) All this fails to [link snipped] ! Edited March 20, 2009 by SmOke_N Link to comment Share on other sites More sharing options...
troglo Posted March 20, 2009 Author Share Posted March 20, 2009 Well first of all controls are windows.What the style $WS_CLIPSIBLINGS does is to prevent the control or window being drawn over an area occupied by another, previously created, control or window which has the same parent window.Thank you: now everything is clear!Troglo 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