Floppy Posted January 11, 2009 Share Posted January 11, 2009 Hi, With this script I can move a control: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <MenuConstants.au3> $hGUI = GUICreate("Test", 300, 200) GUICtrlCreateLabel("Move me", 100, 50, 60, 20) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateButton("hi",40,100,80,23) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN $cInfo = GUIGetCursorInfo($hGUI) $iControl = $cInfo[4] If $iControl Then $aPos = ControlGetPos($hGUI,"",$iControl) $iSubtractX = $cInfo[0]-$aPos[0] $iSubtractY = $cInfo[1]-$aPos[1] Do $cInfo = GUIGetCursorInfo($hGUI) ControlMove($hGUI, "", $iControl, $cInfo[0]-$iSubtractX, $cInfo[1]-$iSubtractY) Until Not $cInfo[2] EndIf EndSwitch WEnd How can i resize and move a control with the mouse? Thanks and bye Note: Sorry for my bad english... Link to comment Share on other sites More sharing options...
rasim Posted January 11, 2009 Share Posted January 11, 2009 See here Link to comment Share on other sites More sharing options...
Floppy Posted January 11, 2009 Author Share Posted January 11, 2009 See hereIt works fine...but if I want to resize all controls?Isn't there a way to make resizable all controls with one line without write the same line for each control? Link to comment Share on other sites More sharing options...
martin Posted January 11, 2009 Share Posted January 11, 2009 (edited) It works fine...but if I want to resize all controls? Isn't there a way to make resizable all controls with one line without write the same line for each control?You would need to loop through each control and size them one at a time. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <WindowsConstants.au3> Global $btn[4] Global $lastv=0, $lasth = 0, $nowv, $nowh #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", 323, 302, 303, 219) For $n = 0 to 3 $Btn[$n] = GUICtrlCreateButton("Button1", 80, 78 + $n * 57, 75, 25, 0) next $Slider1 = GUICtrlCreateSlider(48, 8, 238, 45) $Slider2 = GUICtrlCreateSlider(8, 48, 38, 237, BitOR($TBS_VERT,$TBS_AUTOTICKS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch $nowv = GUICtrlRead($Slider1) $nowh = GUICtrlRead($Slider2) if $nowv <> $lastv or $nowh <> $lasth Then ConsoleWrite($nowh & @CRLF) resizeall($nowv,$nowh) $lastv = $nowv $lasth = $nowh EndIf WEnd Func resizeall($h,$v) for $n = 0 to 3 controlmove($Form3,"",$btn[$n],80,78 +$n*57,75 + $h,25+$v/3) Next EndFunc Edited January 11, 2009 by martin 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...
rasim Posted January 11, 2009 Share Posted January 11, 2009 @FSoftGUICtrlSetResizing? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 11, 2009 Moderators Share Posted January 11, 2009 (edited) @FSoftGUICtrlSetResizing?And if they're UDF controls he's trying to resize?Edit:Yes I know his example doesn't show it, but you know when he uses an owner drawn control, it's going to be the next question. Edited January 11, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Floppy Posted January 11, 2009 Author Share Posted January 11, 2009 @FSoftGUICtrlSetResizing?Maybe you don't understand me...I want a program that allow me to resize with the mouse EACH control in the main window.If there is a button in the main GUI, I want to resize it directly with the mouse...without change anything in the script.I hope I make myself clear...sorry for my bad english! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 11, 2009 Moderators Share Posted January 11, 2009 Maybe you don't understand me... I want a program that allow me to resize with the mouse EACH control in the main window. If there is a button in the main GUI, I want to resize it directly with the mouse...without change anything in the script. I hope I make myself clear...sorry for my bad english!#include <WindowsConstants.au3> Global $h_gui = GUICreate("I am a gui") Global $i_button = GUICtrlCreateButton("I am a button", 100, 50, 100, 25, $WS_SIZEBOX) GUISetState() While GUIGetMsg() <> -3 WEnd Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Floppy Posted January 11, 2009 Author Share Posted January 11, 2009 #include <WindowsConstants.au3> Global $h_gui = GUICreate("I am a gui") Global $i_button = GUICtrlCreateButton("I am a button", 100, 50, 100, 25, $WS_SIZEBOX) GUISetState() While GUIGetMsg() <> -3 WEnd There's a white border around the button...How can i remove it? Link to comment Share on other sites More sharing options...
Xand3r Posted January 11, 2009 Share Posted January 11, 2009 i don't think you can remove that... p.s. i have found something weird when experimenting with smoke_n's example #include <WindowsConstants.au3> #include <GuiConstants.au3> Global $h_gui = GUICreate("I am a gui",-1,-1,-1,-1,BitOR($WS_OVERLAPPEDWINDOW,$WS_CLIPCHILDREN)) GUISetState() Global $edit1 = GUICtrlCreateEdit("editable" , 0, 150, 100, 125, BitOR($WS_CLIPSIBLINGS,$WS_THICKFRAME,$WS_CHILD,$WS_SYSMENU),$WS_EX_TOOLWINDOW) Global $edit2 = GUICtrlCreateEdit("uneditable", 100, 150, 100, 125, BitOR($WS_CLIPSIBLINGS,$WS_THICKFRAME,$WS_CHILD,$WS_SYSMENU,$WS_CAPTION),$WS_EX_TOOLWINDOW) Global $but1 = GUICtrlCreateButton("Focus" , 0,0,100,30) While 1 Switch GUIGetMsg() Case -3 Exit Case $but1 GUICtrlSetState($edit2,$GUI_FOCUS) EndSwitch Sleep(1) WEnd adding ws_caption to the edit (to add a title) makes the $edit2 permanently inactive... (you can not activate it by clicking it) any thoughts? Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro Link to comment Share on other sites More sharing options...
martin Posted January 11, 2009 Share Posted January 11, 2009 There's a white border around the button...How can i remove it?You could have an option somewhere to remove or add the $WS_SIZEBOX from the controls.Can you say what you don't like about MrCreator's udf apart from the fact that it only resizes one control at a a time? 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...
Xand3r Posted January 11, 2009 Share Posted January 11, 2009 You could have an option somewhere to remove or add the $WS_SIZEBOX from the controls.Can you say what you don't like about MrCreator's udf apart from the fact that it only resizes one control at a a time?$WS_SIZEBOX includes $WS_THICKFRAME so it dosen't remove that border Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro Link to comment Share on other sites More sharing options...
martin Posted January 11, 2009 Share Posted January 11, 2009 $WS_SIZEBOX includes $WS_THICKFRAME so it dosen't remove that borderI don't understand you, perhaps because you are wrong. #include <WindowsConstants.au3> $border = True Global $h_gui = GUICreate("I am a gui") Global $i_button = GUICtrlCreateButton("I am a button", 100, 50, 100, 25, $WS_SIZEBOX) GUISetState() While 1 $Msg = GUIGetMsg() If $Msg = -3 Then ExitLoop If $Msg = $i_button Then If $border Then GUICtrlSetStyle($i_button, 0) Else GUICtrlSetStyle($i_button, $WS_SIZEBOX) EndIf $border = Not $border EndIf WEnd 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...
Xand3r Posted January 11, 2009 Share Posted January 11, 2009 I don't understand you, perhaps because you are wrong. #include <WindowsConstants.au3> $border = True Global $h_gui = GUICreate("I am a gui") Global $i_button = GUICtrlCreateButton("I am a button", 100, 50, 100, 25, $WS_SIZEBOX) GUISetState() While 1 $Msg = GUIGetMsg() If $Msg = -3 Then ExitLoop If $Msg = $i_button Then If $border Then GUICtrlSetStyle($i_button, 0) Else GUICtrlSetStyle($i_button, $WS_SIZEBOX) EndIf $border = Not $border EndIf WEnd i'm almoast certain that he wants to be able to resize the button but without having the border Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 11, 2009 Moderators Share Posted January 11, 2009 Could always use the BN_HILITE and BN_UNHILITE + WM_COMMAND with Martins SetStyle routine. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Floppy Posted January 11, 2009 Author Share Posted January 11, 2009 You could have an option somewhere to remove or add the $WS_SIZEBOX from the controls.Can you say what you don't like about MrCreator's udf apart from the fact that it only resizes one control at a a time?It resizes one control at a time and it doesn't show the guide points.For example:I have a window with 2 buttons, 4 labels and other controls all resizable. I can resize these controls clicking on the appropriate guide point.i'm almoast certain that he wants to be able to resize the button but without having the borderYes, but I want also the guide points around the controlsSorry for my bad english Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 11, 2009 Moderators Share Posted January 11, 2009 (edited) It resizes one control at a time and it doesn't show the guide points.For example:I have a window with 2 buttons, 4 labels and other controls all resizable. I can resize these controls clicking on the appropriate guide point.Yes, but I want also the guide points around the controlsSorry for my bad englishWant some fries with that as well?Sorry for my bad ...Edit:I told you what you could do here http://www.autoitscript.com/forum/index.ph...st&p=628061That could solve most of your issue. Edited January 11, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Floppy Posted January 11, 2009 Author Share Posted January 11, 2009 Could always use the BN_HILITE and BN_UNHILITE + WM_COMMAND with Martins SetStyle routine. What are BN_HILITE and BN_UNHILITE + WM_COMMAND with Martins SetStyle routine? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 11, 2009 Moderators Share Posted January 11, 2009 (edited) http://msdn.microsoft.com/en-us/library/bb761833(VS.85).aspxAnd with WM_COMMAND, if you open your help file, go to Search, type in WM_COMMAND you'll see a few examples.Edit:Their constant values (in case they don't exist int he includes) are:Global Const $BN_HILITE = 2Global Const $BN_UNHILITE = 3 Edited January 11, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
rasim Posted January 12, 2009 Share Posted January 12, 2009 (TheMadman @ Jan 11 2009, 04:01 PM) $WS_SIZEBOX includes $WS_THICKFRAME so it dosen't remove that borderI don't understand you, perhaps because you are wrong.He's right: #include <WindowsConstants.au3> MsgBox(0, "WS_THICKFRAME check", BitAND($WS_SIZEBOX, $WS_THICKFRAME) = $WS_THICKFRAME) 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