Jump to content
Sign in to follow this  
AustrianOak

Re-sizing edit control

Recommended Posts

AustrianOak

MrCreator:

The example below is one that you coded and it provides the ability for the user to re-size the edit control.

#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
EndFuncoÝ÷ Ø-+)¢Ë"nW°Øfº[b¦Wv+lêÞßÛ&É«mzjm#fb¨¹Æ§²²(!µ«­¢+Ø¥¹±Õ±ÐíÕ¥
½¹ÍѹÑÍà¹ÔÌÐì(¥¹±Õ±ÐíÕ¥¥Ð¹ÔÌÐì(¥¹±Õ±Ðí]¥¹½ÝÍ
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíU%
Ñɱ}MÑIͥ饹¹ÔÌÐì()±½°ÀÌØí1¥¹
½Õ¹ÐôÄ°ÀÌØí1¥¹1¸ôÀ°ÀÌØí5á1¸ôÀ()¥´ÀÌØí¡%¹ÁÕÑ}U%lÙt°ÀÌØí%¹ÁÕÑlÙt()±½°ÀÌØí±ÍÑÉ%@ô´Ä((ÀÌØí¡U$ôU%
ÉÑ ÅÕ½ÐíQÍÐÅÕ½Ðì°ÌÀÀ°ÈÀÀ¤((ÀÌØíÕÑѽ¸ÔôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐìÅÕ½Ðì°ÄÀÀ°ÄÀÀ°ÐÀ°ÈÔ¤)U%
ÑɱMÑMÑÑ ´Ä°ÀÌØíU%}    UQQ=8¤()U%MÑMÑÑ ¤()U%I¥ÍÑÉ5Í ÀÌØí]5}
=559°ÅÕ½Ðí]5}
=559ÅÕ½Ðì¤()]¡¥±Ä(ÀÌØíµÍôU%Ñ5Í ¤(M±Ð(
ÍÀÌØíµÍôÀÌØíU%}Ù¹Ñ}
±½Í(á¥Ð(
ÍÀÌØíµÍôÀÌØíÕÑѽ¸Ô(%ÀÌØí±ÍÑÉ%@±ÐìÔQ¡¸(ÀÌØí±ÍÑÉ%@¬ôÄ(ÉÑ9áÑÉ%@ ÀÌØí±ÍÑÉ%@¤(¹%(
ÍÀÌØíµÍôÀÌØíU%}Y9Q}AI%5Ie=]8(ÀÌØí5½ÕÍ}A½Ìô5½ÕÍÑA½Ì ¤(ÀÌØíÍ°ô´Ä((½ÈÀÌØí¸ôÀQ¼ÀÌØí±ÍÑÉ%@(U%MÝ¥Ñ  ÀÌØí¡%¹ÁÕÑ}U%lÀÌØí¹t¤(ÀÌØí
ÕÉͽÉ%¹¼ôU%Ñ
ÕÉͽÉ%¹¼ ¤((%9½Ð%ÍÉÉä ÀÌØí
ÕÉͽÉ%¹¼¤Q¡¸
½¹Ñ¥¹Õ1½½À(%ÀÌØí
ÕÉͽÉ%¹½lÑtôÀÌØí%¹ÁÕÑlÀÌØí¹tQ¡¸(ÀÌØíÍ°ôÀÌØí¸(á¥Ñ1½½À(¹%(9áÐ((%ÀÌØíÍ°ô´ÄQ¡¸
½¹Ñ¥¹Õ1½½À(ÀÌØí%¹ÁÕÑU%}A½Ìô]¥¹ÑA½Ì ÀÌØí¡%¹ÁÕÑ}U%lÀÌØíͱt¤((]¡¥±%ÍÉÉä ÀÌØí
ÕÉͽÉ%¹¼¤¹ÀÌØí
ÕÉͽÉ%¹½lÉtôÄ(ÀÌØí
ÕÉͽÉ%¹¼ôU%Ñ
ÕÉͽÉ%¹¼ ¤(ÀÌØí
ÕÉɹÑ}5½ÕÍ}A½Ìô5½ÕÍÑA½Ì ¤((]¥¹5½Ù ÀÌØí¡%¹ÁÕÑ}U%lÀÌØíͱt°ÅÕ½ÐìÅÕ½Ðì°|(ÀÌØí%¹ÁÕÑU%}A½ÍlÁt´ÀÌØí5½ÕÍ}A½ÍlÁt¬ÀÌØí
ÕÉɹÑ}5½ÕÍ}A½ÍlÁt°|(ÀÌØí%¹ÁÕÑU%}A½ÍlÅt´ÀÌØí5½ÕÍ}A½ÍlÅt¬ÀÌØí
ÕÉɹÑ}5½ÕÍ}A½ÍlÅt¤(]¹(¹M±Ð(%}U%
Ñɱ¥Ñ}Ñ1¥¹
½Õ¹Ð¡U%
ÑɱÑ!¹± ÀÌØí¥¹ÁÕФ¤ÐìÀÌØí1¥¹
½Õ¹ÐQ¡¸(ÀÌØí1¥¹
½Õ¹Ðô}U%
Ñɱ¥Ñ}Ñ1¥¹
½Õ¹Ð¡U%
ÑɱÑ!¹± ÀÌØí¥¹ÁÕФ¤(ÀÌØíA½Ìô
½¹Ñɽ±ÑA½Ì ÀÌØí¡U$°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí¥¹ÁÕФ(U%
ÑɱMÑA½Ì ÀÌØí¥¹ÁÕаÀÌØíA½ÍlÁt°ÀÌØíA½ÍlÅt°ÀÌØíA½ÍlÉt°ÀÌØíA½ÍlÍt¬ÄÔ¤(±Í%}U%
Ñɱ¥Ñ}Ñ1¥¹
½Õ¹Ð¡U%
ÑɱÑ!¹± ÀÌØí¥¹ÁÕФ¤±ÐìÀÌØí1¥¹
½Õ¹ÐQ¡¸(ÀÌØí1¥¹
½Õ¹Ðô}U%
Ñɱ¥Ñ}Ñ1¥¹
½Õ¹Ð¡U%
ÑɱÑ!¹± ÀÌØí¥¹ÁÕФ¤(ÀÌØíA½Ìô
½¹Ñɽ±ÑA½Ì ÀÌØí¡U$°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí¥¹ÁÕФ(U%
ÑɱMÑA½Ì ÀÌØí¥¹ÁÕаÀÌØíA½ÍlÁt°ÀÌØíA½ÍlÅt°ÀÌØíA½ÍlÉt°ÀÌØíA½ÍlÍt´ÄÔ¤(¹%)]¹()Õ¹ÉÑ9áÑÉ%@ ÀÌØí¹Ü¤(ÀÌØíÍÑÉÐô]¥¹ÑA½Ì ÀÌØí¡U$¤(ÀÌØí¡%¹ÁÕÑ}U%lÀÌØí¹ÝtôU%
ÉÑ ÅÕ½ÐìÅÕ½Ðì°ÄÈÀ°ÈÈ°ÀÌØíÍÑÉÑlÁt¬ÌÀ°ÀÌØíÍÑÉÑlÅt¬ÄÀÀ°ÀÌØí]M}A=AU@°ÀÌØí]M}a}Q==1]%9=¤(ÀÌØí%¹ÁÕÑlÀÌØí¹ÝtôU%
Ñɱ
ÉѥРÅÕ½ÐìÅÕ½Ðì°À°À°ÄÈÀ°ÈÈ°   ¥Ñ=H ÀÌØíM}UQ=YM
I=10°ÀÌØíM}UQ=!M
I=10°ÀÌØíM}]9QIQUI8¤¤(}U%
Ñɱ}MÑ=¹IÍ¥é ÀÌØí¡%¹ÁÕÑ}U%lÀÌØí¹Ýt°ÀÌØí%¹ÁÕÑlÀÌØí¹Ýt°ÄÀ¤((U%MÑMÑÑ ¤(]¥¹MÑ=¹Q½À ÀÌØí¡%¹ÁÕÑ}U%lÀÌØí¹Ýt°ÅÕ½ÐìÅÕ½Ðì°Ä¤)¹Õ¹ìôôÐíÉÑ9áÑÉ%@()Õ¹]5}
=559 ÀÌØí¡]¹°ÀÌØí5Í°ÀÌØíÝAÉ´°ÀÌØí±AÉ´¤(1½°ÀÌØí¥%ɽ´ô    ¥Ñ9 ÀÌØíÝAÉ´°Áá¤(1½°ÀÌØí¥
½ô    ¥ÑM¡¥Ð ÀÌØíÝAÉ´°Äؤ((MÝ¥Ñ ÀÌØí¥%ɽ´(
ÍÀÌØí¥¹ÁÕÐ(MÝ¥Ñ ÀÌØí¥
½(
ÍÀÌØí9}UAQ(1½°ÀÌØí¥1¸ô}U%
Ñɱ¥Ñ}1¥¹1¹Ñ  ÀÌØí¥¹ÁÕФ(%ÀÌØí¥1¸ÐìÀÌØí5á1¸Q¡¸ÀÌØí5á1¸ôÀÌØí¥1¸(1½°ÀÌØí%¹ÁÕÑA½Ìô
½¹Ñɽ±ÑA½Ì ÀÌØí¡U$°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí¥¹ÁÕФ(% ÀÌØí%¹ÁÕÑA½ÍlÉt¼ÀÌØí5á1¸¤±ÐìظÔQ¡¸(U%
ÑɱMÑA½Ì ÀÌØí¥¹ÁÕаÀÌØí%¹ÁÕÑA½ÍlÁt°ÀÌØí%¹ÁÕÑA½ÍlÅt°ÀÌØí%¹ÁÕÑA½ÍlÉt¬ÄÀ°ÀÌØí%¹ÁÕÑA½ÍlÍt¤(±Í% ÀÌØí%¹ÁÕÑA½ÍlÉt¼ÀÌØí5á1¸¤ÐìÄÀÀQ¡¸(U%
ÑɱMÑA½Ì ÀÌØí¥¹ÁÕаÀÌØí%¹ÁÕÑA½ÍlÁt°ÀÌØí%¹ÁÕÑA½ÍlÅt°ÀÌØí%¹ÁÕÑA½ÍlÉt´ÄÀ°ÀÌØí%¹ÁÕÑA½ÍlÍt¤(¹%(¹MÝ¥Ñ (¹MÝ¥Ñ ((IÑÕɸÀÌØíU%}IU95M)¹Õ¹oÝ÷ Øw«{l¶V®¶­sb6æ6ÇVFRÖöæ6P ¤FÆ$Væ&ÆRgV÷CµôuT7G&Åõ6WE&W6¦æuôæFÆW"gV÷C²ÂS ¤vÆö&Âb33c¶7W'6÷$56WBÒfÇ6P¤vÆö&Âb33c¶7G&ÄVFvU6¦RÒP¤vÆö&Âb33c¶FVd7G&ÄÖå6¦RÒ# ¤vÆö&Âb33c¶6WE&W6¦æuô'%³Õ³Ð £´gVæ7FöâFò6WB&W6¦ærf÷"7V6f26öçG&öÀ¤gVæ2ôuT7G&Åõ6WDöå&W6¦Rb33c¶væBÂb33c¶ä7G&ÄCÒÓÂb33c¶vCÓÂb33c¶7G&ÄÖå6¦SÒb33c¶FVd7G&ÄÖå6¦R¢bb33c¶ä7G&ÄBÒÓFVâb33c¶ä7G&ÄBÒôuTvWDÆ7D7G&ÄB¢¢bæ÷B4væBb33c¶væBFVà¢Æö6Âb33c¶F×6WE&W4'%³Õ³Ð¢¢f÷"b33c¶ÒFòb33c¶6WE&W6¦æuô'%³Õ³Ð¢bb33c¶ä7G&ÄBfÇC²fwC²b33c¶6WE&W6¦æuô'%²b33c¶Õ³ÒFVà¢b33c¶F×6WE&W4'%³Õ³Ò³Ò¢&TFÒb33c¶F×6WE&W4'%²b33c¶F×6WE&W4'%³Õ³Ò³Õ³EТb33c¶F×6WE&W4'%²b33c¶F×6WE&W4'%³Õ³ÕÕ³ÒÒb33c¶6WE&W6¦æuô'%²b33c¶Õ³Ð¢b33c¶F×6WE&W4'%²b33c¶F×6WE&W4'%³Õ³ÕÕ³ÒÒb33c¶6WE&W6¦æuô'%²b33c¶Õ³Ð¢b33c¶F×6WE&W4'%²b33c¶F×6WE&W4'%³Õ³ÕÕ³%ÒÒb33c¶6WE&W6¦æuô'%²b33c¶Õ³%Тb33c¶F×6WE&W4'%²b33c¶F×6WE&W4'%³Õ³ÕÕ³5ÒÒb33c¶6WE&W6¦æuô'%²b33c¶Õ³5ТVæD`¢æW@¢¢uT7G&Å6WD7W'6÷"b33c¶ä7G&ÄBÂÓ¢b33c¶6WE&W6¦æuô'"Òb33c¶F×6WE&W4' ¢¢&WGW&â¢VæD`¢¢b33c¶6WE&W6¦æuô'%³Õ³Ò³Ò¢&TFÒb33c¶6WE&W6¦æuô'%²b33c¶6WE&W6¦æuô'%³Õ³Ò³Õ³EТb33c¶6WE&W6¦æuô'%²b33c¶6WE&W6¦æuô'%³Õ³ÕÕ³ÒÒb33c¶væ@¢b33c¶6WE&W6¦æuô'%²b33c¶6WE&W6¦æuô'%³Õ³ÕÕ³ÒÒb33c¶ä7G&Ä@¢b33c¶6WE&W6¦æuô'%²b33c¶6WE&W6¦æuô'%³Õ³ÕÕ³%ÒÒb33c¶v@¢b33c¶6WE&W6¦æuô'%²b33c¶6WE&W6¦æuô'%³Õ³ÕÕ³5ÒÒb33c¶7G&ÄÖå6¦P¤VæDgVæ0 £´æFÆW"Fò6ÆÂFR6WBgVæ7Föç2f÷"ÆÂ6öçG&öÇ2FBôuT7G&Åõ6WDöå&W6¦R26WB¤gVæ2ôuT7G&Åõ6WE&W6¦æuôæFÆW"¢bb33c¶6WE&W6¦æuô'%³Õ³ÒÒFVâ&WGW&ࢢf÷"b33c¶ÒFòb33c¶6WE&W6¦æuô'%³Õ³Ð¢ôuT7G&Åõ&W6¦æuõ&ö2b33c¶6WE&W6¦æuô'%²b33c¶Õ³ÒÂb33c¶6WE&W6¦æuô'%²b33c¶Õ³ÒÂð¢b33c¶6WE&W6¦æuô'%²b33c¶Õ³%ÒÂb33c¶6WE&W6¦æuô'%²b33c¶Õ³5Ò¢æW@¤VæDgVæ0 £´Öâ&W6¦ær6öçG&öÂgVæ7Föà¤gVæ2ôuT7G&Åõ&W6¦æuõ&ö2b33c¶væBÂb33c¶ä7G&ÄBÂb33c¶vCÓÂb33c¶7G&ÄÖå6¦SÒb33c¶FVd7G&ÄÖå6¦R¢Æö6Âb33c¶7W$æfòÒuTvWD7W'6÷$æfòb33c¶væB¢bW'&÷"FVâ&WGW&ࢢÆö6Âb33c¶7G&ÄæfòÒ6öçG&öÄvWE÷2b33c¶væBÂgV÷C²gV÷C²Âb33c¶ä7G&ÄB¢bW'&÷"FVâ&WGW&ࢢÆö6Âb33c¶7W'6÷$@¢Æö6Âb33c¶6V6´fÆrÒÓ¢Æö6Âb33c¶äöÆEô÷EôtôTÒÒ÷BgV÷C´uTöäWfVçDÖöFRgV÷C²Â¢¢bb33c¶7W$æfõ³ÒfwC²b33c¶7G&Äæfõ³ÒÒb33c¶7G&ÄVFvU6¦RæBb33c¶7W$æfõ³ÒfÇC²b33c¶7G&Äæfõ³Ò²b33c¶7G&ÄVFvU6¦RæBð¢b33c¶7W$æfõ³ÒfwC³Òb33c¶7G&Äæfõ³ÒæBb33c¶7W$æfõ³ÒfÇC³Òb33c¶7G&Äæfõ³Ò²b33c¶7G&Äæfõ³5ÒFVâ´ÆVg@¢¢b33c¶6V6´fÆrÒ¢b33c¶7W'6÷$BÒ0¢VæD`¢¢bb33c¶7W$æfõ³ÒfwC²b33c¶7G&Äæfõ³Ò²b33c¶7G&Äæfõ³%ÒÒb33c¶7G&ÄVFvU6¦RæBð¢b33c¶7W$æfõ³ÒfÇC²b33c¶7G&Äæfõ³Ò²b33c¶7G&Äæfõ³%Ò²b33c¶7G&ÄVFvU6¦RæBð¢b33c¶7W$æfõ³ÒfwC³Òb33c¶7G&Äæfõ³ÒæBb33c¶7W$æfõ³ÒfÇC³Òb33c¶7G&Äæfõ³Ò²b33c¶7G&Äæfõ³5ÒFVâµ&v@¢¢b33c¶6V6´fÆrÒ ¢b33c¶7W'6÷$BÒ0¢VæD`¢¢bb33c¶7W$æfõ³ÒfwC²b33c¶7G&Äæfõ³ÒÒb33c¶7G&ÄVFvU6¦RæBb33c¶7W$æfõ³ÒfÇC²b33c¶7G&Äæfõ³Ò²b33c¶7G&ÄVFvU6¦RæBð¢b33c¶7W$æfõ³ÒfwC³Òb33c¶7G&Äæfõ³ÒæBb33c¶7W$æfõ³ÒfÇC³Òb33c¶7G&Äæfõ³Ò²b33c¶7G&Äæfõ³%ÒFVâµF÷¢¢bb33c¶6V6´fÆrÒFVâ´ÆVgBµF÷¢b33c¶6V6´fÆrÒP¢b33c¶7W'6÷$BÒ ¢VÇ6Tbb33c¶6V6´fÆrÒ"FVâµ&vBµF÷¢b33c¶6V6´fÆrÒp¢b33c¶7W'6÷$BÒ¢VÇ6R´§W7BF÷¢b33c¶6V6´fÆrÒ0¢b33c¶7W'6÷$BÒ¢VæD`¢VæD`¢¢bb33c¶7W$æfõ³ÒfwC²b33c¶7G&Äæfõ³Ò²b33c¶7G&Äæfõ³5ÒÒb33c¶7G&ÄVFvU6¦RæBð¢b33c¶7W$æfõ³ÒfÇC²b33c¶7G&Äæfõ³Ò²b33c¶7G&Äæfõ³5Ò²b33c¶7G&ÄVFvU6¦RæBð¢b33c¶7W$æfõ³ÒfwC³Òb33c¶7G&Äæfõ³ÒæBb33c¶7W$æfõ³ÒfÇC³Òb33c¶7G&Äæfõ³Ò²b33c¶7G&Äæfõ³%ÒFVâ´&÷GFöТ¢bb33c¶6V6´fÆrÒFVâ´ÆVgB´&÷GFöТb33c¶6V6´fÆrÒ`¢b33c¶7W'6÷$BÒ¢VÇ6Tbb33c¶6V6´fÆrÒ"FVâµ&vB´&÷GFöТb33c¶6V6´fÆrÒ¢b33c¶7W'6÷$BÒ ¢VÇ6R´§W7B&÷GFöТb33c¶6V6´fÆrÒ@¢b33c¶7W'6÷$BÒ¢VæD`¢VæD`¢¢bb33c¶6V6´fÆrÒÓFVà¢bb33c¶7W$æfõ³EÒÒ÷"b33c¶7W$æfõ³EÒÒb33c¶ä7G&ÄBæBæ÷Bb33c¶7W'6÷$56WBFVà¢bb33c¶7W$æfõ³EÒÒb33c¶ä7G&ÄBFVâb33c¶7W'6÷$56WBÒG'VP¢uT6WD7W'6÷"ÓÂÂb33c¶væB¢uT7G&Å6WD7W'6÷"b33c¶ä7G&ÄBÂÓ¢VæD`¢¢&WGW&à¢VÇ6P¢b33c¶7W'6÷$56WBÒfÇ6P¢uT7G&Å6WD7W'6÷"b33c¶ä7G&ÄBÂb33c¶7W'6÷$B¢uT6WD7W'6÷"b33c¶7W'6÷$BÂÂb33c¶væB¢VæD`¢¢vÆRb33c¶7W$æfõ³%ÒÒ¢µF2Æö÷2Fò&WfVçB6öçG&öÂÖ÷fVÖVçBvÆRFRÖ÷W6R2æ÷BÖ÷fæp¢vÆRuTvWD×6rfÇC²fwC²Ó²b33c´uTôUdTåEôÔõU4TÔõdP¢6ÆVW¢tVæ@¢¢b33c¶7W$æfòÒuTvWD7W'6÷$æfòb33c¶væB¢bW'&÷"FVâWDÆö÷¢¢b33c¶7G&ÄæfòÒ6öçG&öÄvWE÷2b33c¶væBÂgV÷C²gV÷C²Âb33c¶ä7G&ÄB¢bW'&÷"FVâWDÆö÷¢¢²b33c¶6V6´fÆrfÇVW3 ¢³ÒÆVg@¢³"Ò&v@¢³2ÒF÷¢³BÒ&÷GFöТ³RÒÆVgB²F÷¢³bÒÆVgB²&÷GFöТ³rÒ&vB²F÷¢³Ò&vB²&÷GFöТ¢bb33c¶6V6´fÆrÒ÷"b33c¶6V6´fÆrÒR÷"b33c¶6V6´fÆrÒbFVà¢bb33c¶7G&Äæfõ³%ÒÒb33c¶7W$æfõ³ÒÒb33c¶7G&Äæfõ³ÒfwC²b33c¶7G&ÄÖå6¦RFVâ´Ö÷fRg&öÒÆVg@¢b33c¶7G&Äæfõ³%ÒÒb33c¶7G&Äæfõ³%ÒÒb33c¶7W$æfõ³ÒÒb33c¶7G&Äæfõ³Ò¢b33c¶7G&Äæfõ³ÒÒb33c¶7W$æfõ³Ð¢6öçG&öÄÖ÷fRb33c¶væBÂgV÷C²gV÷C²Âb33c¶ä7G&ÄBÂb33c¶7G&Äæfõ³ÒÂb33c¶7G&Äæfõ³ÒÂb33c¶7G&Äæfõ³%Ò¢VæD`¢VæD`¢¢bb33c¶6V6´fÆrÒ"÷"b33c¶6V6´fÆrÒr÷"b33c¶6V6´fÆrÒFVà¢bb33c¶7W$æfõ³ÒÒb33c¶7G&Äæfõ³ÒfwC²b33c¶7G&ÄÖå6¦RFVâ´Ö÷fRg&öÒ&v@¢b33c¶7G&Äæfõ³%ÒÒb33c¶7W$æfõ³ÒÒb33c¶7G&Äæfõ³Ð¢6öçG&öÄÖ÷fRb33c¶væBÂgV÷C²gV÷C²Âb33c¶ä7G&ÄBÂb33c¶7G&Äæfõ³ÒÂb33c¶7G&Äæfõ³ÒÂb33c¶7G&Äæfõ³%Ò¢VæD`¢VæD`¢¢bb33c¶6V6´fÆrÒ2÷"b33c¶6V6´fÆrÒR÷"b33c¶6V6´fÆrÒrFVà¢bb33c¶7G&Äæfõ³5ÒÒb33c¶7W$æfõ³ÒÒb33c¶7G&Äæfõ³ÒfwC²b33c¶7G&ÄÖå6¦RFVâ´Ö÷fRg&öÒF÷¢b33c¶7G&Äæfõ³5ÒÒb33c¶7G&Äæfõ³5ÒÒb33c¶7W$æfõ³ÒÒb33c¶7G&Äæfõ³Ò¢b33c¶7G&Äæfõ³ÒÒb33c¶7W$æfõ³Ð¢6öçG&öÄÖ÷fRb33c¶væBÂgV÷C²gV÷C²Âb33c¶ä7G&ÄBÂb33c¶7G&Äæfõ³ÒÂb33c¶7G&Äæfõ³ÒÂb33c¶7G&Äæfõ³%ÒÂb33c¶7G&Äæfõ³5Ò¢VæD`¢VæD`¢¢bb33c¶6V6´fÆrÒB÷"b33c¶6V6´fÆrÒb÷"b33c¶6V6´fÆrÒFVà¢bb33c¶7W$æfõ³ÒÒb33c¶7G&Äæfõ³ÒfwC²b33c¶7G&ÄÖå6¦RFVâ´Ö÷fRg&öÒ&÷GFöТb33c¶7G&Äæfõ³5ÒÒb33c¶7W$æfõ³ÒÒb33c¶7G&Äæfõ³Ð¢6öçG&öÄÖ÷fRb33c¶væBÂgV÷C²gV÷C²Âb33c¶ä7G&ÄBÂb33c¶7G&Äæfõ³ÒÂb33c¶7G&Äæfõ³ÒÂb33c¶7G&Äæfõ³%ÒÂb33c¶7G&Äæfõ³5Ò¢VæD`¢VæD`¢¢6ÆVWb33c¶vB¢tVæ@¢¢÷BgV÷C´uTöäWfVçDÖöFRgV÷C²Âb33c¶äöÆEô÷EôtôTÒ¤VæDgVæ0 £´gVæ7FöâFòvWBÆ7B7G&ÄBâ66RFBW6W"vÆÂ72Ó2b33c¶7G&ÄB¤gVæ2ôuTvWDÆ7D7G&ÄB¢Æö6Âb33c¶&WBÒFÆÄ6ÆÂgV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C´vWDFÆt7G&ÄBgV÷C²ÂgV÷C¶væBgV÷C²ÂuT7G&ÄvWDæFÆRÓ¢¢&WGW&âb33c¶&WE³Ð¤VæDgVæ

Share this post


Link to post
Share on other sites
martin

I=10°ÀÌØíM}UQ=!M

I=10°ÀÌØíM}]9QIQUI8¤¤(}U%

Ñɱ}MÑ=¹IÍ¥é ÀÌØí¡%¹ÁÕÑ}U%lÀÌØí¹Ýt°ÀÌØí%¹ÁÕÑlÀÌØí¹Ýt°ÄÀ¤((U%MÑMÑÑ ¤(]¥¹MÑ=¹Q½À ÀÌØí¡%¹ÁÕÑ}U%lÀÌØí¹Ýt°ÅÕ½ÐìÅÕ½Ðì°Ä¤)¹Õ¹ìôôÐíÉÑ9áÑÉ%@()Õ¹]5}

=559 ÀÌØí¡]¹°ÀÌØí5Í°ÀÌØíÝAÉ´°ÀÌØí±AÉ´¤(1½°ÀÌØí¥%ɽ´ô ¥Ñ9 ÀÌØíÝAÉ´°Áá¤(1½°ÀÌØí¥

½ô ¥ÑM¡¥Ð ÀÌØíÝAÉ´°Äؤ((MݥѠÀÌØí¥%ɽ´(

ÍÀÌØí¥¹ÁÕÐ(MݥѠÀÌØí¥

½(

ÍÀÌØí9}UAQ(1½°ÀÌØí¥1¸ô}U%

Ñɱ¥Ñ}1¥¹1¹Ñ  ÀÌØí¥¹ÁÕФ(%ÀÌØí¥1¸ÐìÀÌØí5á1¸Q¡¸ÀÌØí5á1¸ôÀÌØí¥1¸æ÷B4væBb33c¶væBFVà¢Æö6

Âb33c¶F×6WE&W4'%³Õ³Ð¢¢f÷"b33c¶ÒFòb33c¶6WE&W6¦æuô'%³Õ³Ð¢bb33c¶ä7G&ÄBfÇC²fwC²b33c¶6WE&W6¦æuô'%²b33c¶Õ³ÒFVà¢b33c¶F×6WE&W4'%³Õ³Ò³Ò¢&TFÒb33c¶F×6WE&W4'%²b33c¶F×6WE&W4'%³Õ³Ò³Õ³EТb3¢bb33c¶7W$æfõ³ÒfwC²b33c¶7G&Äæfõ³Ò²b33c¶7G&Äæfõ³%ÒÒb33c¶7G&ÄVFvU6¦RæBð¢b33c¶7W$æfõ³ÒfÇC²b33c¶7W'6÷$BÒ¢VæD`¢VæD`¢¢bb33c¶6V6´fÆrÒÓFVà¢bb33c¶FöâFòvWBÆ7B7G&ÄBâ66RFBW6W"vÆÂ72Ó2b33c¶7G&ÄB¤gVæ2ôuTvWDÆ7D7G&ÄB¢Æö6Âb33c¶&WBÒFÆÄ6ÆÂgV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C´vWDFÆt7G&ÄBgV÷C²ÂgV÷C¶væBgV÷C²ÂuT7G&ÄvWDæFÆRÓ¢¢&WGW&âb33c¶&WE³Ð¤VæDgVæ

You can see from the shortened version above why I am continually asking people not to use autoit tags (as requested my signature). Please use code tags.

You need to modify the udf to allow dragging instead of trying to drag in your main script. Also I changed the edits to be created in the first gui not in new windows. This version of your script lets you drag the edges of more than one edit but it is not easy as you can't tell which edit you will be changing.

#include <GuiConstantsEx.au3>
#include <GuiEdit.au3>
#include <WindowsConstants.au3>
#include <GUICtrl_SetResizing.au3>

Global $LineCount = 1, $LineLen = 0, $MaxLen = 0

Dim $hInput_GUI[6], $Input[6]

Global $lastdragIP = -1

$hGUI = GUICreate("Test", 300, 200)

$button5 = GUICtrlCreateButton("", 100, 100, 40, 25)
GUICtrlSetState(-1, $GUI_DEFBUTTON)

GUISetState()

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_Event_Close
            Exit
            Case $msg = $button5
            If $lastdragIP < 5 Then
                $lastdragIP += 1
                createNextdragIP($lastdragIP)
            EndIf
       #cs Case $msg = $GUI_EVENT_PRIMARYDOWN
            $aMouse_Pos = MouseGetPos()
            $sel = -1
           
            For $n = 0 To $lastdragIP
                GUISwitch($hInput_GUI[$n])
                $aCursorInfo = GUIGetCursorInfo()
               
                If Not IsArray($aCursorInfo) Then ContinueLoop
                If $aCursorInfo[4] = $Input[$n] Then
                    $sel = $n
                    ExitLoop
                EndIf
            Next
           
            If $sel = -1 Then ContinueLoop
            $aInputGUI_Pos = WinGetPos($hInput_GUI[$sel])
           
           While IsArray($aCursorInfo) And $aCursorInfo[2] = 1
                $aCursorInfo = GUIGetCursorInfo()
                $aCurrent_Mouse_Pos = MouseGetPos()

                WinMove($hInput_GUI[$sel], "", _
                $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _
                $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1])
            WEnd
            #ce
    EndSelect
    If _GUICtrlEdit_GetLineCount(GUICtrlGetHandle($input)) > $LineCount Then
        $LineCount = _GUICtrlEdit_GetLineCount(GUICtrlGetHandle($input))
        $aPos = ControlGetPos($hGUI, "", $input)
        GUICtrlSetPos($input, $aPos[0], $aPos[1], $aPos[2], $aPos[3] + 15)
    ElseIf _GUICtrlEdit_GetLineCount(GUICtrlGetHandle($input)) < $LineCount Then
        $LineCount = _GUICtrlEdit_GetLineCount(GUICtrlGetHandle($input))
        $aPos = ControlGetPos($hGUI, "", $input)
        GUICtrlSetPos($input, $aPos[0], $aPos[1], $aPos[2], $aPos[3] - 15)
    EndIf
WEnd

Func createNextdragIP($nw)
 ;$start = WinGetPos($hGUI)
; $hInput_GUI[$nw] = GUICreate("", 120, 22, $start[0]+30, $start[1]+100, $WS_POPUP, $WS_EX_TOOLWINDOW)
    $Input[$nw] = GUICtrlCreateEdit("", 0, 0, 120, 22, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
    _GUICtrl_Setonresize($hGUI, $Input[$nw], 10)
   
 ;GUISetState()
 ;WinSetOnTop($hInput_GUI[$nw], "", 1)
EndFunc;==>createNextdragIP

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $iIDFrom = BitAND($wParam, 0xFFFF)
    Local $iCode = BitShift($wParam, 16)
   
    Switch $iIDFrom
        Case $input
            Switch $iCode
                Case $EN_UPDATE
                    Local $iLen = _GUICtrlEdit_LineLength($input)
                    If $iLen > $MaxLen Then $MaxLen = $iLen
                    Local $aInputPos = ControlGetPos($hGUI, "", $input)
                    If ($aInputPos[2] / $MaxLen) < 6.5 Then
                        GUICtrlSetPos($input, $aInputPos[0], $aInputPos[1], $aInputPos[2] + 10, $aInputPos[3])
                    ElseIf ($aInputPos[2] / $MaxLen) > 100 Then
                        GUICtrlSetPos($input, $aInputPos[0], $aInputPos[1], $aInputPos[2] - 10, $aInputPos[3])
                    EndIf
            EndSwitch
    EndSwitch
   
    Return $GUI_RUNDEFMSG   
EndFunc

BTW it might have been better to post this in MrCreatoR's thread for the udf.

Edited 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.

Share this post


Link to post
Share on other sites
AustrianOak

thank you martin. will try it.

Share this post


Link to post
Share on other sites
AustrianOak

martin:

the reason i created this post was to have re-sizing capability on multiple edits and also that they be draggable. i noticed the lines you commented out that were responsible for moving the edit. I uncommented them out but then the re-sizing capability goes away.

and i also adjusted the _GUICtrl_SetOnResizing() and still doesn't work.

can you help?

Share this post


Link to post
Share on other sites
AustrianOak

Bump.

Just in case you didnt understand my previous post I would like to know how to duplicate what you did in your last post but having the edits be moveable like in mine.

Share this post


Link to post
Share on other sites
AustrianOak

Bump

Share this post


Link to post
Share on other sites
Szhlopp

Bump

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
;
Global $Size = False
$Form1 = GUICreate("Form1", 625, 445, 193, 125)
$Edit1 = GUICtrlCreateEdit("", 119, 108, 132, 137)
GUICtrlSetData(-1, "Edit1")
$Edit2 = GUICtrlCreateEdit("", 324, 108, 132, 137)
GUICtrlSetData(-1, "Edit2")
$SizeBox = GUICtrlCreateButton("Size", 10, 410, 80, 30)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $SizeBox
            
            If $Size = False Then
                GUICtrlSetStyle($Edit2, $WS_SIZEBOX)
                GUICtrlSetStyle($Edit1, $WS_SIZEBOX)
                $Size = True
            ElseIf $Size = True Then
                GUICtrlSetStyle($Edit2, $GUI_SS_DEFAULT_EDIT)
                GUICtrlSetStyle($Edit1, $GUI_SS_DEFAULT_EDIT)
                $Size = False
            EndIf
            

    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
AustrianOak

Thanks for the attempt Szhlopp but you missed the point.

the reason i created this post was to have re-sizing capability on multiple edits and also that they be draggable

martin made a perfectly working example of this except i need the labels to be draggable. like in my first post.

Share this post


Link to post
Share on other sites
Szhlopp

Thanks for the attempt Szhlopp but you missed the point.

martin made a perfectly working example of this except i need the labels to be draggable. like in my first post.

Here ya go... Posted it in example scripts: Drag and Resize

Share this post


Link to post
Share on other sites
AustrianOak

ok, will test later.

Share this post


Link to post
Share on other sites
AustrianOak

Szhlopp:

I guess its a good concept example but I cant even get it working without the mouse trap feature. Not to mention you completely disregarded my concept of moving the controls (using a gui and setting a pic).

This is a little to far off from what I'm looking for.

Thanks for attempt.

Share this post


Link to post
Share on other sites
Szhlopp

Szhlopp:

I guess its a good concept example but I cant even get it working without the mouse trap feature. Not to mention you completely disregarded my concept of moving the controls (using a gui and setting a pic).

This is a little to far off from what I'm looking for.

Thanks for attempt.

Hey man, I created something that works VERY well and is a GREAT starting point for doing this. It totally enables the user to move AND resize the controls on the GUI.

Just an FYI. I'm not going to try and help you much now. Good luck on finding someone to write you something better!

:)

Share this post


Link to post
Share on other sites
AustrianOak

Don't get all mad on me dude.

I said it was a good concept example. If you want other praise then somethings wrong.

Edited by AustrianOak

Share this post


Link to post
Share on other sites
AustrianOak

Bump

Share this post


Link to post
Share on other sites
martin

Bump

As I mentioned before, you need to modify MrCreatoR's udf.

Here is a modified version

CODE

#include-once

AdlibEnable("_GUICtrl_SetResizing_Handler", 50)

Global $iCursorIsSet = False

Global $iCtrlEdgeSize = 5

Global $iDefCtrlMinSize = 20

Global $aSetResizing_Arr[1][1]

;Function to set resizing for specific control

Func _GUICtrl_Setonresize($hWnd, $nCtrlID=-1, $iWait=10, $iCtrlMinSize=$iDefCtrlMinSize)

If $nCtrlID = -1 Then $nCtrlID = _GUIGetLastCtrlID()

If Not IsHWnd($hWnd) Then

Local $aTmpSetResArr[1][1]

For $i = 1 To $aSetResizing_Arr[0][0]

If $nCtrlID <> $aSetResizing_Arr[$i][1] Then

$aTmpSetResArr[0][0] += 1

ReDim $aTmpSetResArr[$aTmpSetResArr[0][0]+1][4]

$aTmpSetResArr[$aTmpSetResArr[0][0]][0] = $aSetResizing_Arr[$i][0]

$aTmpSetResArr[$aTmpSetResArr[0][0]][1] = $aSetResizing_Arr[$i][1]

$aTmpSetResArr[$aTmpSetResArr[0][0]][2] = $aSetResizing_Arr[$i][2]

$aTmpSetResArr[$aTmpSetResArr[0][0]][3] = $aSetResizing_Arr[$i][3]

EndIf

Next

GUICtrlSetCursor($nCtrlID, -1)

$aSetResizing_Arr = $aTmpSetResArr

Return 1

EndIf

$aSetResizing_Arr[0][0] += 1

ReDim $aSetResizing_Arr[$aSetResizing_Arr[0][0]+1][4]

$aSetResizing_Arr[$aSetResizing_Arr[0][0]][0] = $hWnd

$aSetResizing_Arr[$aSetResizing_Arr[0][0]][1] = $nCtrlID

$aSetResizing_Arr[$aSetResizing_Arr[0][0]][2] = $iWait

$aSetResizing_Arr[$aSetResizing_Arr[0][0]][3] = $iCtrlMinSize

EndFunc

;Handler to call the set functions (for all controls that _GUICtrl_Setonresize() is set)

Func _GUICtrl_SetResizing_Handler()

If $aSetResizing_Arr[0][0] = 0 Then Return

For $i = 1 To $aSetResizing_Arr[0][0]

_GUICtrl_Resizing_Proc($aSetResizing_Arr[$i][0], $aSetResizing_Arr[$i][1], _

$aSetResizing_Arr[$i][2], $aSetResizing_Arr[$i][3])

Next

EndFunc

;Main Resizing Control Function

Func _GUICtrl_Resizing_Proc($hWnd, $nCtrlID, $iWait=10, $iCtrlMinSize=$iDefCtrlMinSize)

Local $aCurInfo = GUIGetCursorInfo($hWnd)

Local $mp1 = MouseGetpos()

Local $mp

If @error Then Return

Local $aCtrlInfo = ControlGetPos($hWnd, "", $nCtrlID)

If @error Then Return

Local $iCursorID

Local $iCheckFlag = -1

Local $nOld_Opt_GOEM = Opt("GUIOnEventMode", 0)

If ($aCurInfo[0] > $aCtrlInfo[0] - $iCtrlEdgeSize And $aCurInfo[0] < $aCtrlInfo[0] + $iCtrlEdgeSize) 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]) - $iCtrlEdgeSize And _

$aCurInfo[0] < ($aCtrlInfo[0]+$aCtrlInfo[2]) + $iCtrlEdgeSize) And _

($aCurInfo[1] >= $aCtrlInfo[1] And $aCurInfo[1] <= $aCtrlInfo[1]+$aCtrlInfo[3]) Then ;Right

$iCheckFlag = 2

$iCursorID = 13

EndIf

If ($aCurInfo[1] > $aCtrlInfo[1] - $iCtrlEdgeSize And $aCurInfo[1] < $aCtrlInfo[1] + $iCtrlEdgeSize) 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]) - $iCtrlEdgeSize And _

$aCurInfo[1] < ($aCtrlInfo[1]+$aCtrlInfo[3]) + $iCtrlEdgeSize) 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

If ($aCurInfo[4] = 0 Or $aCurInfo[4] = $nCtrlID) And Not $iCursorIsSet Then

If $aCurInfo[4] = $nCtrlID Then $iCursorIsSet = True

GUISetCursor(-1, 0, $hWnd)

GUICtrlSetCursor($nCtrlID, -1)

EndIf

If $aCurInfo[4] <> $nCtrlID Then Return

Else

$iCursorIsSet = False

GUICtrlSetCursor($nCtrlID, $iCursorID)

GUISetCursor($iCursorID, 0, $hWnd)

EndIf

$aCtrlInfo1 = ControlGetPos($hWnd, "", $nCtrlID)

While $aCurInfo[2] = 1

;This loop is to prevent control movement while the mouse is not moving

While GUIGetMsg() <> -11 ;$GUI_EVENT_MOUSEMOVE

Sleep(10)

WEnd

$aCurInfo = GUIGetCursorInfo($hWnd)

If @error Then ExitLoop

$aCtrlInfo = ControlGetPos($hWnd, "", $nCtrlID)

If @error Then ExitLoop

; $iCheckFlag Values:

;1 = Left

;2 = Right

;3 = Top

;4 = Bottom

;5 = Left + Top

;6 = Left + Bottom

;7 = Right + Top

;8 = Right + Bottom

If $iCheckFlag = 1 Or $iCheckFlag = 5 Or $iCheckFlag = 6 Then

If $aCtrlInfo[2] - ($aCurInfo[0]-$aCtrlInfo[0]) > $iCtrlMinSize Then ;Move from Left

$aCtrlInfo[2] = $aCtrlInfo[2]-($aCurInfo[0]-$aCtrlInfo[0])

$aCtrlInfo[0] = $aCurInfo[0]

ControlMove($hWnd, "", $nCtrlID, $aCtrlInfo[0], $aCtrlInfo[1], $aCtrlInfo[2])

EndIf

EndIf

If $iCheckFlag = 2 Or $iCheckFlag = 7 Or $iCheckFlag = 8 Then

If $aCurInfo[0] - $aCtrlInfo[0] > $iCtrlMinSize Then ;Move from Right

$aCtrlInfo[2] = $aCurInfo[0]-$aCtrlInfo[0]

ControlMove($hWnd, "", $nCtrlID, $aCtrlInfo[0], $aCtrlInfo[1], $aCtrlInfo[2])

EndIf

EndIf

If $iCheckFlag = 3 Or $iCheckFlag = 5 Or $iCheckFlag = 7 Then

If $aCtrlInfo[3] - ($aCurInfo[1]-$aCtrlInfo[1]) > $iCtrlMinSize Then ;Move from Top

$aCtrlInfo[3] = $aCtrlInfo[3]-($aCurInfo[1]-$aCtrlInfo[1])

$aCtrlInfo[1] = $aCurInfo[1]

ControlMove($hWnd, "", $nCtrlID, $aCtrlInfo[0], $aCtrlInfo[1], $aCtrlInfo[2], $aCtrlInfo[3])

EndIf

EndIf

If $iCheckFlag = 4 Or $iCheckFlag = 6 Or $iCheckFlag = 8 Then

If $aCurInfo[1] - $aCtrlInfo[1] > $iCtrlMinSize Then ;Move from Bottom

$aCtrlInfo[3] = $aCurInfo[1]-$aCtrlInfo[1]

ControlMove($hWnd, "", $nCtrlID, $aCtrlInfo[0], $aCtrlInfo[1], $aCtrlInfo[2], $aCtrlInfo[3])

EndIf

EndIf

If $iCheckFlag = -1 Then

$mp = mousegetpos()

;ConsoleWrite($mp[0] & ',' & $mp[1] & ' : ' & $mp1[0] & ',' & $mp1[1] & @CRLF)

ControlMove($hWnd, "", $nCtrlID, $aCtrlInfo1[0] + $mp[0]-$mp1[0], $aCtrlInfo1[1] + $mp[1]- $mp1[1]);, $aCtrlInfo[2], $aCtrlInfo[3])

EndIf

Sleep($iWait)

WEnd

Opt("GUIOnEventMode", $nOld_Opt_GOEM)

EndFunc

;Function to get last CtrlID (in case that user will pass -1 as $iCtrlID)

Func _GUIGetLastCtrlID()

Local $aRet = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1))

Return $aRet[0]

EndFunc

Then the script I posted before can be used with that udf and you can resize and move the edits.

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.

Share this post


Link to post
Share on other sites
AustrianOak

it disappears when moved beyond the windows client area

Share this post


Link to post
Share on other sites
AustrianOak

Bump

Share this post


Link to post
Share on other sites
martin

it disappears when moved beyond the windows client area

Try to understand how it works and so you can fix it yourself.

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.

Share this post


Link to post
Share on other sites
AustrianOak

In doing so I ended up destroying the re-sizable functionality and the draggable.

Share this post


Link to post
Share on other sites
AustrianOak

Bump

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×