Jump to content

GUI_Extender - New Version 16 Apr 2022


Melba23
 Share

Recommended Posts

Dear Melba,

I am creating a GUI using the GUI Extender UDF you created. I don't understand why the first line created by GUICtrlCreateGraphic is changing after using the UDF.
Here is before & after screenshot and code.

Opt("GUIOnEventMode", 1)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include "GUIExtender.au3"

#Region (=== GUI generated by GuiBuilderPlus 1.2.0 ===)
Global $g_gui_Main

;------------------------------------------------------
; Title...........: _guiCreate
; Description.....: Create the main GUI
;------------------------------------------------------
Func _guiCreate()
    $g_gui_Main = GUICreate("Droid Control", 800, 360, -1, -1)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_onExitMain")
    GUISetBkColor(0xFFFFFF)

    _GUIExtender_Init($g_gui_Main, 1, 1, True)
    _GUIExtender_Section_Create($g_gui_Main, Default, 400)
    _GUIExtender_Section_Activate($g_gui_Main, 2)
    Local $g_group_DeviceList = GUICtrlCreateGroup("Device List", 5, 5, 390, 135, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER))
    Local $g_btn_Refresh = GUICtrlCreateButton("Refresh", 320, 20, 70, 53)
    GUICtrlSetOnEvent(-1, "Refresh")
    Local $g_btn_Reset = GUICtrlCreateButton("Reset", 320, 83, 70, 52)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    Local $g_group_Wireless = GUICtrlCreateGroup("Wireless", 5, 145, 390, 40, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER))
    Local $g_btn_GetIP = GUICtrlCreateButton("Get IP", 10, 160, 70, 20)
    Local $g_btn_Connect = GUICtrlCreateButton("Connect", 320, 160, 70, 20)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    Local $g_group_Details = GUICtrlCreateGroup("Details", 5, 190, 390, 140, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER))
    $g_graphic_Line = GUICtrlCreateGraphic(81, 220, 309, 105)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_PENSIZE, 1)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_COLOR, 0x000000)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 309, 0)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 0, 33)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 309, 33)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 0, 51)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 309, 51)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 0, 69)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 117, 69)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 0, 87)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 117, 87)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 192, 69)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 309, 69)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 192, 87)
    GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 309, 87)
    Local $g_lbl_User_1 = GUICtrlCreateLabel("User", 10, 205, 66, 15)
    Local $g_lbl_User_2 = GUICtrlCreateLabel(":", 76, 205, 5, 15)
    Local $g_data_User = GUICtrlCreateLabel("", 81, 205, 309, 15)
    Local $g_lbl_Account_1 = GUICtrlCreateLabel("Accounts", 10, 223, 73, 30)
    Local $g_lbl_Account_2 = GUICtrlCreateLabel(":", 76, 223, 2, 30)
    Local $g_data_Account = GUICtrlCreateLabel("", 81, 223, 309, 30)
    Local $g_lbl_Model_1 = GUICtrlCreateLabel("Device Model", 10, 256, 66, 15)
    Local $g_lbl_Model_2 = GUICtrlCreateLabel(":", 76, 256, 5, 15)
    Local $g_data_Model = GUICtrlCreateLabel("", 81, 256, 309, 15)
    Local $g_lbl_Serial_1 = GUICtrlCreateLabel("Device Serial", 10, 274, 66, 15)
    Local $g_lbl_Serial_2 = GUICtrlCreateLabel(":", 76, 274, 5, 15)
    Local $g_data_Serial_2 = GUICtrlCreateLabel("", 81, 274, 117, 15)
    Local $g_lbl_Battery_1 = GUICtrlCreateLabel("Battery Status", 10, 292, 66, 15)
    Local $g_lbl_Battery_2 = GUICtrlCreateLabel(":", 76, 292, 5, 15)
    Local $g_data_Battery = GUICtrlCreateLabel("", 81, 292, 117, 15)
    Local $g_lbl_Uptime_1 = GUICtrlCreateLabel("Up Time", 10, 310, 66, 15)
    Local $g_lbl_Uptime_2 = GUICtrlCreateLabel(":", 76, 310, 5, 15)
    Local $g_data_Uptime = GUICtrlCreateLabel("", 81, 310, 117, 15)
    Local $g_lbl_Connection_1 = GUICtrlCreateLabel("Connected by", 202, 274, 66, 15)
    Local $g_lbl_Connection_2 = GUICtrlCreateLabel(":", 268, 274, 5, 15)
    Local $g_data_Connection = GUICtrlCreateLabel("", 273, 274, 117, 15)
    Local $g_lbl_Wifi_1 = GUICtrlCreateLabel("Wi-Fi SSID", 202, 292, 66, 15)
    Local $g_lbl_Wifi_2 = GUICtrlCreateLabel(":", 268, 292, 5, 15)
    Local $g_data_Wifi = GUICtrlCreateLabel("", 273, 292, 117, 15)
    Local $g_lbl_IP_1 = GUICtrlCreateLabel("IP Address", 202, 310, 66, 15)
    Local $g_lbl_IP_2 = GUICtrlCreateLabel(":", 268, 310, 5, 15)
    Local $g_data_IP = GUICtrlCreateLabel("", 273, 310, 117, 15)
    GUICtrlSetColor(-1, 0x006A4E)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    _GUIExtender_Section_Create($g_gui_Main, Default, Default)

    Local $g_group_Options = GUICtrlCreateGroup("Options", 405, 5, 315, 135, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER))
    Local $g_lbl_Title_1 = GUICtrlCreateLabel("Window Title", 410, 22, 62, 15)
    Local $g_lbl_Title_2 = GUICtrlCreateLabel(":", 472, 22, 5, 15)
    Local $g_input_Title = GUICtrlCreateEdit("", 478, 20, 237, 17)
    Local $g_chk_AlwaysOnTop = GUICtrlCreateCheckbox("Always On Top", 410, 43, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE))
    Local $g_chk_Borderless = GUICtrlCreateCheckbox("Borderless", 512, 43, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE))
    Local $g_chk_FullScreen = GUICtrlCreateCheckbox("Full Screen", 613, 43, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE))
    Local $g_chk_NoScreenSaver = GUICtrlCreateCheckbox("No ScreenSaver", 410, 74, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE))
    Local $g_chk_PowerOffOnExit = GUICtrlCreateCheckbox("Power Off On Exit", 512, 74, 96, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE))
    Local $g_chk_ShowTouch = GUICtrlCreateCheckbox("Show Touch", 613, 74, 96, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE))
    Local $g_chk_StayAwake = GUICtrlCreateCheckbox("Stay Awake", 410, 105, 96, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE))
    Local $g_chk_TurnOffTheScreen = GUICtrlCreateCheckbox("Turn Off The Screen", 512, 105, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE))
    Local $g_chk_ViewOnlyMode = GUICtrlCreateCheckbox("View Only Mode", 613, 105, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE))
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    GUICtrlSetColor(-1, 0x006A4E)

    Local $g_group_Resolution = GUICtrlCreateGroup("Resolution", 725, 5, 70, 65, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER))
    Local $g_rad_ResolutionAuto = GUICtrlCreateRadio("Auto", 730, 20, 60, 20)
    Local $g_rad_ResolutionMax = GUICtrlCreateRadio("Max", 730, 45, 60, 20)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    Local $g_group_Shortcut = GUICtrlCreateGroup("ShortCut", 725, 75, 70, 65, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER))
    Local $g_rad_ShortcutCtrl = GUICtrlCreateRadio("Ctrl", 730, 90, 60, 20)
    Local $g_rad_ShortcutAlt = GUICtrlCreateRadio("Alt", 730, 115, 60, 20)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    Local $g_group_Parameter = GUICtrlCreateGroup("Parameter", 405, 145, 390, 130, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER))
    Local $g_lbl_Parameter = GUICtrlCreateLabel("g_ini_ScrcpyCommand", 410, 160, 380, 30)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    GUICtrlSetColor(-1, 0x006A4E)
    Local $g_btn_DeviceShutdown = GUICtrlCreateButton("Device%CRLF%Shutdown", 405, 280, 70, 50, $BS_MULTILINE)
    Local $g_btn_DeviceReboot = GUICtrlCreateButton("Device%CRLF%Reboot", 485, 280, 70, 50, $BS_MULTILINE)
    Local $g_btn_DisplayPowerOnOff = GUICtrlCreateButton("Display%CRLF%On / Off", 565, 280, 70, 50, $BS_MULTILINE)
    Local $g_btn_DeviceUnlock = GUICtrlCreateButton("Device%CRLF%Unlock", 645, 280, 70, 50, $BS_MULTILINE)
    Local $g_btn_ScrcpyOn = GUICtrlCreateButton("Scrcpy%CRLF%On", 725, 280, 70, 50, BitOR($BS_MULTILINE, $GUI_SS_DEFAULT_BUTTON, $BS_FLAT))
    _GUIExtender_Section_Create($g_gui_Main, -99)
    _GUIExtender_Section_Action($g_gui_Main, 2, False) ; hide section 2
EndFunc   ;==>_guiCreate
#EndRegion (=== GUI generated by GuiBuilderPlus 1.2.0 ===)

_main()

;------------------------------------------------------
; Title...........: _main
; Description.....: run the main program loop
;------------------------------------------------------
Func _main()
    _guiCreate()
    GUISetState(@SW_SHOWNORMAL)

    While 1
        Sleep(100)
    WEnd
EndFunc   ;==>_main

Func Refresh()
    _GUIExtender_Section_Action($g_gui_Main, 2, 9)
EndFunc   ;==>Refresh

;------------------------------------------------------
; Title...........: _onExitMain
; Description.....: Clean up and exit the program
;------------------------------------------------------
Func _onExitMain()
    GUIDelete()
    Exit
EndFunc   ;==>_onExitMain

 

Screenshot_4.png

Screenshot_5.png

Link to comment
Share on other sites

  • Moderators

rakibdepu,

I am afraid I have no idea why the graphic line is altered in that way, sorry. I am not sure I have ever used the UDF with graphic controls, so such an anomaly does not surprise me.

But I may have a work-around solution for you. Looking at the GUICtrlSetGraphic section, I noticed that there was no $GUI_GR_MOVE command before the first $GUI_GR_LINE. Adding one meant that the line now stays where it is supposed to be on expansion - or at least it does for me:

$g_graphic_Line = GUICtrlCreateGraphic(81, 220, 309, 105)
GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_PENSIZE, 1)
GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_COLOR, 0x000000)
GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 0, 0) ; <<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 309, 0)

Does that solve your immediate problem?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Dear Melba,

YES 😃
Thanks for the quick reply.
I have one more small question, please guide me if possible.
I wanted to also add the details group into the UDF section, so that after the gui is open, when the refresh button is clicked, the details group will first extend to the bottom, after five seconds the rest of the gui will open to the right.

Link to comment
Share on other sites

  • Moderators

rakibdepu,

Glad I could solve the problem.

As to your new request, I am afraid the UDF only operates in one sense - horizontally or vertically - so you cannot use it to do what you wish, sorry.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

rakibdepu,

Please do not hold your breath! I looked into the possibility of doing 2-way expansion when I was writing the UDF and it soon became obvious that it was a complete non-starter as it would mean having a base GUI of different widths/heights from which to expand. It was difficult enough to get the various sums correct when dealing with a base GUI of a stable size!

Any way, delighted I could at least offer you a solution to your original problem.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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