AustrianOak Posted July 10, 2008 Share Posted July 10, 2008 (edited) How can I make a resizeable edit where I can take the corner and drag it in or out to make it larger or smaller. I don't know if I saw the style or not in the helpfile so I need some help. Edited July 10, 2008 by nowagain Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted July 10, 2008 Moderators Share Posted July 10, 2008 You can use GUICtrlSetResizing to have it resize along with the GUI. Link to comment Share on other sites More sharing options...
AustrianOak Posted July 10, 2008 Author Share Posted July 10, 2008 But will this "manually" allow me to re-size it. I think I know what you're getting at but my situation is different and the gui size does not matter. Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 10, 2008 Share Posted July 10, 2008 (edited) Ok, here is a prototype of resizable control (tested only with Edit control)... expandcollapse popup#include <GuiConstantsEx.au3> $hGUI = GUICreate("Resizable GUI Ctrl - Example", 300, 200) $Edit = GUICtrlCreateEdit("", 20, 40, 260, 120) GUISetState(@SW_SHOW, $hGUI) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case Else _GUICtrl_SetResize($Edit, 5, 20, $hGUI) EndSwitch WEnd Func _GUICtrl_SetResize($nCtrlID, $iDefaultCurID, $iWait=10, $hWnd=0) Local $aCurInfo = GUIGetCursorInfo($hGUI) If @error Then Return Local $aCtrlInfo = ControlGetPos($hGUI, "", $nCtrlID) If @error Then Return Local $iCursorID, $iCheckFlag = -1 If ($aCurInfo[0] > $aCtrlInfo[0]-2 And $aCurInfo[0] < $aCtrlInfo[0]+2) And _ ($aCurInfo[1] >= $aCtrlInfo[1] And $aCurInfo[1] <= $aCtrlInfo[1]+$aCtrlInfo[3]) Then ;Left $iCheckFlag = 1 $iCursorID = 13 EndIf If ($aCurInfo[0] > ($aCtrlInfo[0]+$aCtrlInfo[2])-2 And $aCurInfo[0] < ($aCtrlInfo[0]+$aCtrlInfo[2])+2) And _ ($aCurInfo[1] >= $aCtrlInfo[1] And $aCurInfo[1] <= $aCtrlInfo[1]+$aCtrlInfo[3]) Then ;Right $iCheckFlag = 2 $iCursorID = 13 EndIf If ($aCurInfo[1] > $aCtrlInfo[1]-2 And $aCurInfo[1] < $aCtrlInfo[1]+2) And _ ($aCurInfo[0] >= $aCtrlInfo[0] And $aCurInfo[0] <= $aCtrlInfo[0]+$aCtrlInfo[2]) Then ;Top If $iCheckFlag = 1 Then ;Left+Top $iCheckFlag = 5 $iCursorID = 12 ElseIf $iCheckFlag = 2 Then ;Right+Top $iCheckFlag = 7 $iCursorID = 10 Else ;Just Top $iCheckFlag = 3 $iCursorID = 11 EndIf EndIf If ($aCurInfo[1] > ($aCtrlInfo[1]+$aCtrlInfo[3])-2 And $aCurInfo[1] < ($aCtrlInfo[1]+$aCtrlInfo[3])+2) And _ ($aCurInfo[0] >= $aCtrlInfo[0] And $aCurInfo[0] <= $aCtrlInfo[0]+$aCtrlInfo[2]) Then ;Bottom If $iCheckFlag = 1 Then ;Left+Bottom $iCheckFlag = 6 $iCursorID = 10 ElseIf $iCheckFlag = 2 Then ;Right+Bottom $iCheckFlag = 8 $iCursorID = 12 Else ;Just Bottom $iCheckFlag = 4 $iCursorID = 11 EndIf EndIf If $iCheckFlag = -1 Then GUICtrlSetCursor($nCtrlID, $iDefaultCurID) GUISetCursor(-1, 1, $hGUI) Return Else GUICtrlSetCursor($nCtrlID, $iCursorID) GUISetCursor($iCursorID, 1, $hGUI) EndIf While $aCurInfo[2] = 1 $aCurInfo = GUIGetCursorInfo($hGUI) If @error Then ExitLoop $aCtrlInfo = ControlGetPos($hGUI, "", $nCtrlID) If @error Then ExitLoop GUISetState(@SW_LOCK) If $iCheckFlag = 1 Or $iCheckFlag = 5 Or $iCheckFlag = 6 Then ;Left If $aCtrlInfo[2] - ($aCurInfo[0]-$aCtrlInfo[0]) > 20 Then _ GUICtrlSetPos($nCtrlID, $aCurInfo[0], -1, $aCtrlInfo[2] - ($aCurInfo[0]-$aCtrlInfo[0])) EndIf If $iCheckFlag = 2 Or $iCheckFlag = 7 Or $iCheckFlag = 8 Then ;Right If $aCurInfo[0] - $aCtrlInfo[0] > 20 Then _ GUICtrlSetPos($nCtrlID, -1, -1, $aCurInfo[0]-$aCtrlInfo[0]) EndIf If $iCheckFlag = 3 Or $iCheckFlag = 5 Or $iCheckFlag = 7 Then ;Top If $aCtrlInfo[3] - ($aCurInfo[1]-$aCtrlInfo[1]) > 20 Then _ GUICtrlSetPos($nCtrlID, -1, $aCurInfo[1], -1, $aCtrlInfo[3] - ($aCurInfo[1]-$aCtrlInfo[1])) EndIf If $iCheckFlag = 4 Or $iCheckFlag = 6 Or $iCheckFlag = 8 Then ;Bottom If $aCurInfo[1] - $aCtrlInfo[1] > 20 Then _ GUICtrlSetPos($nCtrlID, -1, -1, -1, $aCurInfo[1]-$aCtrlInfo[1]) EndIf GUISetState(@SW_UNLOCK) Sleep($iWait) WEnd EndFunc Needs more polishing, for example if you resize the control to out of the GUI borders and leave it there, you will not be able to resize back muttley - there is need to add some type of limit control... But it works Edited April 7, 2011 by MrCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
AustrianOak Posted July 11, 2008 Author Share Posted July 11, 2008 Thank you MsCreator! i will try to make it re-sizeable at the corner Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 11, 2008 Share Posted July 11, 2008 i will try to make it re-sizeable at the cornerIt is already muttleyAnd i made a UDF from it: GUICtrl_SetResizing - UDF! Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
AustrianOak Posted July 12, 2008 Author Share Posted July 12, 2008 (edited) This is great! I posted on your UDF topic. Thanks for all your help. Edited July 12, 2008 by nowagain 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