Jump to content

Convert 2006 script to 2015


MyEarth
 Share

Recommended Posts

Hello ;)

I need something like this script, a sort of re-arrangement of element in a GUI (and save it the result in a INI, i can do it by myself later) and after some research i have found this old script by GaryFrost

#include <GUIConstants.au3>

Opt("MustDeclareVars", 1)

Global $MODE = 2   ; 2 = waiting to move, 3 = moving
Global $INITMOVE = 2, $MOVING = 3
Global $cursorInfo, $hover, $currentCtrl, $xOffset, $yOffset, $c
Global $grippySize = 6 ;pixel size

_Main()

Func _Main()
    Local $main, $menu_Config, $menu_move, $overlay
    Local $grippy[9] ;I'll use indices 1 - 8
    Local $background, $Button_1, $Button_2, $label, $pic, $msg
    $main = GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered
    $menu_Config = GUICtrlCreateMenu("Config")
    $menu_move = GUICtrlCreateMenuitem("Move Controls", $menu_Config)
    $overlay = GUICtrlCreateLabel("foo", -99, -99, 1, 1, 0x107)  ;transparent label with black border


    For $i = 1 To 8
        $grippy[$i] = GUICtrlCreateLabel("", -99, -99, $grippySize, $grippySize, 0x104) ;black square
    Next


    $background = GUICtrlCreatePic("", 0, 0, 1024, 768);, $BACKG_STYLE) ;used to show a grid
    GUICtrlSetState($background, 128) ;disable background so that user can click buttons

    $Button_1 = GUICtrlCreateButton("Run Notepad", 10, 30, 100, 25)
    $Button_2 = GUICtrlCreateButton("Button Test", 10, 60, 100, 25)
    $label = GUICtrlCreateLabel("This is my lable", 10, 90, 120, 25)
    $pic = GUICtrlCreatePic(@SystemDir & "\oobe\images\mslogo.jpg", 10, 120, 200, 50)

    GUISetState()      ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg(1)
        Select
            Case $msg[0] = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg[0] = $Button_1
                Run('Notepad.exe')    ; Will Run/Open Notepad
            Case $msg[0] = $Button_2
                MsgBox(0, 'Testing', 'Button 2 was pressed')    ; Will demonstrate Button 2 being pressed
            Case $msg[0] = $menu_move
                If BitAND(GUICtrlRead($menu_move), $GUI_CHECKED) Then
                    GUICtrlSetState($menu_move, $GUI_UNCHECKED)
                Else
                    GUICtrlSetState($menu_move, $GUI_CHECKED)
                EndIf
            Case $msg[0] = $overlay And BitAND(GUICtrlRead($menu_move), $GUI_CHECKED)
                _InitMove($main, $overlay)
        EndSelect
        If BitAND(GUICtrlRead($menu_move), $GUI_CHECKED) Then _MoveItem($main, $grippy, $background, $overlay)
    WEnd
EndFunc   ;==>_Main

Func _InitMove(ByRef $main, ByRef $overlay, $ShowTip = False)
    Local $p
    ; drag and drop any control; when done moving, the control will show grippies around it
    $MODE = $MOVING
    $currentCtrl = $hover ;control under the overlay
    $c = ControlGetPos($main, "", $currentCtrl)
    $p = GUIGetCursorInfo($main)
    $xOffset = $p[0] - $c[0]
    $yOffset = $p[1] - $c[1]
    If $ShowTip Then ToolTip($xOffset & "," & $yOffset)
    GUICtrlSetPos($overlay, -99, -99, 1, 1) ;"hide" overlay since we don't need it
    ;EndIf
EndFunc   ;==>_InitMove

Func _MoveItem(ByRef $main, ByRef $grippy, ByRef $background, ByRef $overlay, $ShowTip = False)
    Local $wgcs, $cp, $p
    $cursorInfo = GUIGetCursorInfo()
    Select
        Case $cursorInfo[4] = $grippy[1] ;North-East
            GUISetCursor(12, 1)
        Case $cursorInfo[4] = $grippy[2] ;North
            GUISetCursor(11, 1)
        Case $cursorInfo[4] = $grippy[3] ;North-West
            GUISetCursor(10, 1)
        Case $cursorInfo[4] = $grippy[4] ;West
            GUISetCursor(13, 1)
        Case $cursorInfo[4] = $grippy[5] ;East
            GUISetCursor(13, 1)
        Case $cursorInfo[4] = $grippy[6] ;South-East
            GUISetCursor(10, 1)
        Case $cursorInfo[4] = $grippy[7] ;South
            GUISetCursor(11, 1)
        Case $cursorInfo[4] = $grippy[8] ;South-West
            GUISetCursor(12, 1)
    EndSelect
    ;If cursor is out of bounds, then continue loop
    $wgcs = WinGetClientSize($main)
    If $cursorInfo[0] <= 0 Or $cursorInfo[1] <= 0 Or $cursorInfo[0] >= $wgcs[0] Or $cursorInfo[1] >= $wgcs[1] Then Return
    ; When cursor hovers over a control, change cursor to the sizeall cursor
    ;  I could use GUICtrlSetCursor instead, but that might hurt performance a bit
    If $cursorInfo[4] = 0 Or $cursorInfo[4] = $background Or ($cursorInfo[4] >= $grippy[1] And $cursorInfo[4] <= $grippy[8]) Then
        $hover = 0
        GUICtrlSetPos($overlay, -99, -99, 1, 1)
    Else
        If $cursorInfo[4] <> $overlay Then
            $hover = $cursorInfo[4]

        EndIf
        $cp = ControlGetPos("", "", $cursorInfo[4])
        If $MODE = $INITMOVE Then
            GUICtrlSetPos($overlay, $cp[0], $cp[1], $cp[2], $cp[3])
            If ($cursorInfo[4] < $grippy[1] Or $cursorInfo[4] > $grippy[8]) Then GUISetCursor(2, 1) ;2=regular arrow cursor
        EndIf
    EndIf
    If $MODE = $MOVING Then ;moving
        GUISetCursor(9, 1) ;9=sizeall

        $p = GUIGetCursorInfo($main)
        If $ShowTip Then ToolTip("(" & $p[0] & ", " & $p[1] & ")")

        If $c[0] <> $p[0] Or $c[1] <> $p[1] Then
            GUICtrlSetPos($currentCtrl, $p[0] - $xOffset, $p[1] - $yOffset, $c[2], $c[3])
            $c[0] = $p[0]
            $c[1] = $p[1]
        EndIf

        For $i = 1 To 8
            GUICtrlSetPos($grippy[$i], -99, -99, $grippySize, $grippySize) ;"hide" grippies
        Next


        If $cursorInfo[2] = 0 Then
            $MODE = $INITMOVE ;end move mode and go back to ready-to-move mode
            ToolTip('')
        EndIf
    EndIf
EndFunc   ;==>_MoveItem

Some magic number and work only partially, i can move element after i select the apposite menu but i don't see any "grippy" for resize the control, there are different cursors so there is a reason, or any "grid" (from the comment $BACKG_STYLE) ;used to show a grid) in the background

 

If someone can help me to "upgrade" to the actual standard i'm grateful. Thanks

 

I don't need a Koda replacer or anything similar, i want to apply only to my GUI

EDIT: Another version by the same author, consider it like an initial release. I'll post it if need:

#include <GUIConstants.au3>

$main = GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered
$menu_Config = GUICtrlCreateMenu("Config")
$menu_move = GUICtrlCreateMenuitem("Move Controls", $menu_Config)
Dim $overlayTarget  ;guiID# of control under the overlay
$overlay = GUICtrlCreateLabel("foo", -99, -99, 1, 1, 0x107)  ;transparent label with black border

$grippySize = 6 ;pixel size
Dim $grippy[9] ;I'll use indices 1 - 8
For $i = 1 To 8
    $grippy[$i] = GUICtrlCreateLabel("", -99, -99, $grippySize, $grippySize, 0x104) ;black square
Next

Global $NorthWest_Grippy = $grippy[1]
Global $North_Grippy = $grippy[2]
Global $NorthEast_Grippy = $grippy[3]
Global $West_Grippy = $grippy[4]
Global $East_Grippy = $grippy[5]
Global $SouthWest_Grippy = $grippy[6]
Global $South_Grippy = $grippy[7]
Global $SouthEast_Grippy = $grippy[8]

Global $MODE = 2   ; 2 = waiting to move, 3 = moving
Global $INITMOVE = 2, $MOVING = 3
Global $cursorInfo, $hover
$background = GUICtrlCreatePic("", 0, 0, 1024, 768);, $BACKG_STYLE) ;used to show a grid
GUICtrlSetState($background, 128) ;disable background so that user can click buttons

$Button_1 = GUICtrlCreateButton("Run Notepad", 10, 30, 100, 25)
$Button_2 = GUICtrlCreateButton("Button Test", 10, 60, 100, 25)
$label = GUICtrlCreateLabel("This is my lable", 10, 90, 120, 25)

GUISetState()      ; will display an  dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg(1)
    Select
        Case $msg[0] = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg[0] = $Button_1
            Run('Notepad.exe')    ; Will Run/Open Notepad
        Case $msg[0] = $Button_2
            MsgBox(0, 'Testing', 'Button 2 was pressed')    ; Will demonstrate Button 2 being pressed
        Case $msg[0] = $menu_move
            If BitAND(GUICtrlRead($menu_move), $GUI_CHECKED) Then
                GUICtrlSetState($menu_move, $GUI_UNCHECKED)
            Else
                GUICtrlSetState($menu_move, $GUI_CHECKED)
            EndIf
        Case $msg[0] = $overlay And BitAND(GUICtrlRead($menu_move), $GUI_CHECKED)
            ; drag and drop any control; when done moving, the control will show grippies around it
            ;If $hover <> $grippyCtrl Then
            $grippyCtrl = $hover
            ;Else
            $MODE = $MOVING
            $currentCtrl = $hover ;control under the overlay

            $c = ControlGetPos($main, "", $currentCtrl)
            $p = GUIGetCursorInfo($main)
            $xOffset = $p[0] - $c[0]
            $yOffset = $p[1] - $c[1]
            ToolTip($xOffset & "," & $yOffset)
            GUICtrlSetPos($overlay, -99, -99, 1, 1) ;"hide" overlay since we don't need it
            ;EndIf
    EndSelect
    If BitAND(GUICtrlRead($menu_move), $GUI_CHECKED) Then
        $cursorInfo = GUIGetCursorInfo()
        Select
            Case $cursorInfo[4] = $grippy[1] ;North-East
                GUISetCursor(12, 1)
            Case $cursorInfo[4] = $grippy[2] ;North
                GUISetCursor(11, 1)
            Case $cursorInfo[4] = $grippy[3] ;North-West
                GUISetCursor(10, 1)
            Case $cursorInfo[4] = $grippy[4] ;West
                GUISetCursor(13, 1)
            Case $cursorInfo[4] = $grippy[5] ;East
                GUISetCursor(13, 1)
            Case $cursorInfo[4] = $grippy[6] ;South-East
                GUISetCursor(10, 1)
            Case $cursorInfo[4] = $grippy[7] ;South
                GUISetCursor(11, 1)
            Case $cursorInfo[4] = $grippy[8] ;South-West
                GUISetCursor(12, 1)
        EndSelect
        ;If cursor is out of bounds, then continue loop
        $wgcs = WinGetClientSize($main)
        If $cursorInfo[0] <= 0 Or $cursorInfo[1] <= 0 Or $cursorInfo[0] >= $wgcs[0] Or $cursorInfo[1] >= $wgcs[1] Then
            ;;;;;;If $cursorInfo[2] = 1 Then ContinueLoop  ;if mouse button down
            ;If $mode = 3 Then ;drawing
            ;   ; HELP KEEP OVERLAY AND CONTROL IN SYNC WHEN USER MOVES MOUSE QUICKLY
            ;   $c = ControlGetPos($main,"",$currentCtrl)
            ;   GuiCtrlSetPos($overlay, $p[0]-$xOffset, $p[1]-$yOffset, $c[2], $c[3])
            ;EndIf
            ContinueLoop
        EndIf
        ; When cursor hovers over a control, change cursor to the sizeall cursor
        ;  I could use GUICtrlSetCursor instead, but that might hurt performance a bit
        If $cursorInfo[4] = 0 Or $cursorInfo[4] = $background Or ($cursorInfo[4] >= $grippy[1] And $cursorInfo[4] <= $grippy[8]) Then
            $hover = 0
;~          If ($cursorInfo[4] < $grippy[1] Or $cursorInfo[4] > $grippy[8]) Then GUISetCursor(3, 1) ;3=crosshair cursor
            GUICtrlSetPos($overlay, -99, -99, 1, 1)
        Else
            If $cursorInfo[4] <> $overlay Then
                $hover = $cursorInfo[4]

            EndIf
            $cp = ControlGetPos("", "", $cursorInfo[4])
            If $MODE = $INITMOVE Then
                GUICtrlSetPos($overlay, $cp[0], $cp[1], $cp[2], $cp[3])
                If ($cursorInfo[4] < $grippy[1] Or $cursorInfo[4] > $grippy[8]) Then GUISetCursor(2, 1) ;2=regular arrow cursor
                ;;;showGrippies($overlay)
            EndIf
        EndIf
        If $MODE = $MOVING Then ;moving
            GUISetCursor(9, 1) ;9=sizeall

            ;;$p = GuiGetCursorInfo($main)  ;$p[0] = x  and $p[1] = y
            $p = GUIGetCursorInfo($main)
            ToolTip("(" & $p[0] & ", " & $p[1] & ")")


            GUICtrlSetPos($currentCtrl, $p[0] - $xOffset, $p[1] - $yOffset, $c[2], $c[3])
            ;;;GuiCtrlSetPos($overlay, $p[0]-$xOffset, $p[1]-$yOffset, $c[2], $c[3])

            For $i = 1 To 8
                GUICtrlSetPos($grippy[$i], -99, -99, $grippySize, $grippySize) ;"hide" grippies
            Next


            If $cursorInfo[2] = 0 Then
                $MODE = $INITMOVE ;end move mode and go back to ready-to-move mode
;~          GUICtrlSetState($background, 128) ;disable background so that user can click buttons
                $currentType = ""
                ToolTip('')
            EndIf
        EndIf
    EndIf
WEnd
Edited by MyEarth
Link to comment
Share on other sites

Some progress:

#include <GUIConstants.au3>
#include <Constants.au3>

Global $iMODE = 2 ; 2 = waiting to move, 3 = moving
Global $iINITMOVE = 2, $iMOVING = 3
Global $aCursorInfo, $iHover, $iCurrCtrl, $xOffset, $yOffset, $aCtrlGetPos

Global $iGrippySize = 6 ;pixel size
Global $aGrippy[9] ;I'll use indices 1 - 8

Global $hGUI, $hMenu, $hMenuMove, $hOverlay
Global $hButton1, $hButton2, $hLabel, $hPic, $nMsg, $hBackground

$hGUI = GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered
$hMenu = GUICtrlCreateMenu("Config")
$hMenuMove = GUICtrlCreateMenuItem("Move Controls", $hMenu)
$hOverlay = GUICtrlCreateLabel("", -99, -99, 1, 1, 0x107) ; transparent label with black border

For $i = 1 To 8
    $aGrippy[$i] = GUICtrlCreateLabel("", -99, -99, $iGrippySize, $iGrippySize, 0x104) ;black square
Next

$hBackground = GUICtrlCreatePic("", 0, 0, 1024, 768); $BACKG_STYLE) ;used to show a grid
GUICtrlSetState(-1, $GUI_DISABLE) ;disable background so that user can click buttons

$hButton1 = GUICtrlCreateButton("Run Notepad", 10, 30, 100, 25)
$hButton2 = GUICtrlCreateButton("Button Test", 10, 60, 100, 25)
$hLabel = GUICtrlCreateLabel("This is my label", 10, 90)
$hPic = GUICtrlCreatePic(RegRead('HKLM\SOFTWARE\AutoIt v3\Autoit', 'InstallDir') & "\Examples\GUI\mslogo.jpg", 10, 120, 200, 50)

GUISetState() ; will display an  dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton1
            Run('Notepad.exe') ; Will Run/Open Notepad
        Case $hButton2
            MsgBox(0, 'Testing', 'Button 2 was pressed') ; Will demonstrate Button 2 being pressed
        Case $hMenuMove
            If BitAND(GUICtrlRead($hMenuMove), $GUI_CHECKED) Then
                GUICtrlSetState($hMenuMove, $GUI_UNCHECKED)
            Else
                GUICtrlSetState($hMenuMove, $GUI_CHECKED)
            EndIf
        Case $hOverlay
            If BitAND(GUICtrlRead($hMenuMove), $GUI_CHECKED) Then _InitMove($hGUI, $hOverlay)
    EndSwitch
    If BitAND(GUICtrlRead($hMenuMove), $GUI_CHECKED) Then _MoveItem($hGUI, $aGrippy, $hBackground, $hOverlay)
WEnd

Func _InitMove($hGUI, $hOverlay)
    Local $aCursorInfo = GUIGetCursorInfo($hGUI)
    $iMODE = $iMOVING
    $iCurrCtrl = $iHover ;control under the overlay
    $aCtrlGetPos = ControlGetPos($hGUI, "", $iCurrCtrl)
    $xOffset = $aCursorInfo[0] - $aCtrlGetPos[0]
    $yOffset = $aCursorInfo[1] - $aCtrlGetPos[1]
    GUICtrlSetPos($hOverlay, -99, -99, 1, 1) ;"hide" overlay since we don't need it
EndFunc   ;==>_InitMove

Func _MoveItem($hGUI, $aGrippy, $hBackground, $hOverlay, $ShowTip = True)
    Local $aWinGetSize, $aLocalGetPos
    $aCursorInfo = GUIGetCursorInfo()
    Select
        Case $aCursorInfo[4] = $aGrippy[1] ;North-East
            GUISetCursor(12, 1)
        Case $aCursorInfo[4] = $aGrippy[2] ;North
            GUISetCursor(11, 1)
        Case $aCursorInfo[4] = $aGrippy[3] ;North-West
            GUISetCursor(10, 1)
        Case $aCursorInfo[4] = $aGrippy[4] ;West
            GUISetCursor(13, 1)
        Case $aCursorInfo[4] = $aGrippy[5] ;East
            GUISetCursor(13, 1)
        Case $aCursorInfo[4] = $aGrippy[6] ;South-East
            GUISetCursor(10, 1)
        Case $aCursorInfo[4] = $aGrippy[7] ;South
            GUISetCursor(11, 1)
        Case $aCursorInfo[4] = $aGrippy[8] ;South-West
            GUISetCursor(12, 1)
    EndSelect
    ;If cursor is out of bounds, then continue loop
    $aWinGetSize = WinGetClientSize($hGUI)
    If $aCursorInfo[0] <= 0 Or $aCursorInfo[1] <= 0 Or $aCursorInfo[0] >= $aWinGetSize[0] Or $aCursorInfo[1] >= $aWinGetSize[1] Then Return
    ; When cursor hovers over a control, change cursor to the sizeall cursor
    ;  I could use GUICtrlSetCursor instead, but that might hurt performance a bit
    If $aCursorInfo[4] = 0 Or $aCursorInfo[4] = $hBackground Or ($aCursorInfo[4] >= $aGrippy[1] And $aCursorInfo[4] <= $aGrippy[8]) Then
        $iHover = 0
        GUICtrlSetPos($hOverlay, -99, -99, 1, 1)
    Else
        If $aCursorInfo[4] <> $hOverlay Then
            $iHover = $aCursorInfo[4]
        EndIf
        $aCtrlGetPos = ControlGetPos("", "", $aCursorInfo[4])
        If $iMODE = $iINITMOVE Then
            GUICtrlSetPos($hOverlay, $aCtrlGetPos[0], $aCtrlGetPos[1], $aCtrlGetPos[2], $aCtrlGetPos[3])
            If ($aCursorInfo[4] < $aGrippy[1] Or $aCursorInfo[4] > $aGrippy[8]) Then GUISetCursor(2, 1) ;2=regular arrow cursor
            _ShowGrippies($hGUI, $iCurrCtrl)
        EndIf
    EndIf
    If $iMODE = $iMOVING Then ;moving
        GUISetCursor(9, 1) ;9=sizeall
        $aLocalGetPos = GUIGetCursorInfo($hGUI)
        If $ShowTip Then ToolTip("(" & $aLocalGetPos[0] & ", " & $aLocalGetPos[1] & ")")
        If $aCtrlGetPos[0] <> $aLocalGetPos[0] Or $aCtrlGetPos[1] <> $aLocalGetPos[1] Then
            GUICtrlSetPos($iCurrCtrl, $aLocalGetPos[0] - $xOffset, $aLocalGetPos[1] - $yOffset, $aCtrlGetPos[2], $aCtrlGetPos[3])
            $aCtrlGetPos[0] = $aLocalGetPos[0]
            $aCtrlGetPos[1] = $aLocalGetPos[1]
        EndIf
        If $aCursorInfo[2] = 0 Then
            $iMODE = $iINITMOVE ;end move mode and go back to ready-to-move mode
            ToolTip('')
        EndIf
        _HideGrippies()
    EndIf
EndFunc   ;==>_MoveItem

Func _ShowGrippies($hGUI, $iCurrCtrl)
    Local $aCtrlGetPos = ControlGetPos($hGUI, "", $iCurrCtrl)
    GUICtrlSetPos($aGrippy[1], $aCtrlGetPos[0] - $iGrippySize, $aCtrlGetPos[1] - $iGrippySize, $iGrippySize, $iGrippySize) ;NW
    GUICtrlSetPos($aGrippy[2], $aCtrlGetPos[0] + ($aCtrlGetPos[2] - $iGrippySize) / 2, $aCtrlGetPos[1] - $iGrippySize, $iGrippySize, $iGrippySize) ;N
    GUICtrlSetPos($aGrippy[3], $aCtrlGetPos[0] + ($aCtrlGetPos[2]), $aCtrlGetPos[1] - $iGrippySize, $iGrippySize, $iGrippySize) ;NE
    GUICtrlSetPos($aGrippy[4], $aCtrlGetPos[0] - $iGrippySize, $aCtrlGetPos[1] + ($aCtrlGetPos[3] - $iGrippySize) / 2, $iGrippySize, $iGrippySize) ;W
    GUICtrlSetPos($aGrippy[5], $aCtrlGetPos[0] + $aCtrlGetPos[2], $aCtrlGetPos[1] + ($aCtrlGetPos[3] - $iGrippySize) / 2, $iGrippySize, $iGrippySize) ;E
    GUICtrlSetPos($aGrippy[6], $aCtrlGetPos[0] - $iGrippySize, $aCtrlGetPos[1] + $aCtrlGetPos[3], $iGrippySize, $iGrippySize) ;SW
    GUICtrlSetPos($aGrippy[7], $aCtrlGetPos[0] + ($aCtrlGetPos[2] - $iGrippySize) / 2, $aCtrlGetPos[1] + $aCtrlGetPos[3], $iGrippySize, $iGrippySize) ;S
    GUICtrlSetPos($aGrippy[8], $aCtrlGetPos[0] + ($aCtrlGetPos[2]), $aCtrlGetPos[1] + $aCtrlGetPos[3], $iGrippySize, $iGrippySize) ;SE
EndFunc   ;==>_ShowGrippy

Func _HideGrippies()
    For $i = 1 To 8
        GUICtrlSetPos($aGrippy[$i], -99, -99, $iGrippySize, $iGrippySize) ;"hide" grippies
    Next
EndFunc   ;==>_HideGrippy

Some variable name change, still not understand that magic number for labels, grippies now show but don't resize.

Waiting for experts

Edited by MyEarth
Link to comment
Share on other sites

  • Moderators

The magic numbers are bad practice, for exactly the reason you're experiencnig - makes it hard to read for anyone else. In this case, the author was using the magic numbers for the various styles he applied to the label. Look in the help file under GUICtrlCreateLabel, and you will see a link to the GUI Control Styles Appendix. Click on this and you should easily be able to correlate the magic number to the style in use.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

The code is not complete as it contains only the part used to move controls

As said GaryFrost this code is a part of GuiBuilder v0.8 by CyberSlug and updated by TheSaint

You will need to search in the source to grab the wanted part

Download link :

<link removed>

Edited by Melba23
Link to comment
Share on other sites

The script crash when you try to click on whatever button with an array error...I am not surprised since that was coded for the 3.1.1.0 and seeing as i don't need an EXE version / Koda replacer i'm in the same situation :(

Thanks for the help

Oh, before i forget, also that version is full of magic numbers

Edited by MyEarth
Link to comment
Share on other sites

  • Moderators

That is just the point, MyEarth, the code is old and outdated. You will need to go through it line by line, put in debugging to see where it is failing, and if it is due to magic numbers, update to current code standards. It is tedious yes, but we don't much go in for spoon feeding code to folks.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

The code is not complete as it contains only the part used to move controls

As said GaryFrost this code is a part of GuiBuilder v0.8 by CyberSlug and updated by TheSaint

You will need to search in the source to grab the wanted part

Download link :

THANKS Melba23

Hi mikell, can you please refrain from linking directly to downloads, and link to the source page instead.

There is a reason why the download is set up the way it is.

In any case, that version is old and jaberwacky is working on the >latest version here.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

@mikell - no worries.

Another place to look, is >here.

Partially >updated earlier version of GUIBuilder that doesn't require the Beta, but may not be fully working.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

If we are just talking about programmatic changes, then have you checked out GUICtrlSetResizing?

If not, and we are talking about manually resizing via grab handles or grippies, then check out what jaberwacky is doing at the first link I posted.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Image my GUI can create a N number of element ( like 2 or more edit control with different content ) based on user choice like a multple notepad on the same interface, just for make an example. Now the position and the size of the control is the only things user can't change ( actually is fixed by GUI size ) so i'd like to add a sort of "design mode" for make the user move-resize-delete the control and make layout like he like.

For this reason i have opened this thread and searching a (working) script like the GaryFrost but nothing too complex like a gui editor because i need to manage it :D

I'll check for jaberwacky's script, hope i'll understand it :D

Edited by MyEarth
Link to comment
Share on other sites

@mikell - a lot of interesting stuff to read about and discover there.

@MyEarth - I don't envy you the level of difficulty you are like to find. For a few select programs, I have enabled window resizing and positioning, with controls adjusting for that (within reason), and that was tricky enough. Changing control positions and dragging them around is pretty complex from my point of view and knowledge. Don't know many programs that allow that, especially in AutoIt, which is probably not the ideal language for that ... though you can do it of course, as shown by GUIBuilder etc.

P.S. I've also created a LESS and MORE button on a few programs, so you can have a choice of minimalist or advanced settings, with a bigger or smaller window. So alternate layouts is not too hard to script for.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

 

... re-arrangement of element in a GUI .....

 

 

This example >here might interest you.  I have just been playing with it and it appears to still work fine.  It both moves and resizes controls on a GUI by adding two lines only to your GUI script. 

When the controls are where you want them, you can delete the two lines of code.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...