Sign in to follow this  
Followers 0
MikahS

Auto Resizing of ListView in GUI Window

8 posts in this topic

#1 ·  Posted (edited)

Hello AutoIt community,

I have a question for you. I have 3 separate ListViews which need to be auto sized to the GUI width / height. I've looked around the forum for a day or two and have tried using the WM_SIZE method, which after playing with it, I've realized that not everyone's screen is the same and hardcoding it could be troublesome.

So, I'm thinking I need to come up with a better way of resizing my ListViews to my GUI. Does anyone have any suggestions on different ways of achieving this goal?

Example script:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=
#AutoIt3Wrapper_Outfile=
#AutoIt3Wrapper_Res_Comment=
#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_Fileversion=
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****



#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <GUIListBox.au3>
#include <GuiListView.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <ScrollBarConstants.au3>
#include <Misc.au3>
#include <GuiScrollBars.au3>
;~ #include <GUIListViewEx.au3>

Local $List1, $List2, $List3, $List4, $lp_Buffer = 0
Local $List1Ex, $List2Ex, $List3Ex

GUI()

GUIRegisterMsg($WM_SIZE, "WM_SIZE")

_GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List2), $SB_BOTH, $ESB_DISABLE_BOTH)
_GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List3), $SB_BOTH, $ESB_DISABLE_BOTH)


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Quit()
    EndSwitch
WEnd

;END MAIN LINE


Func Quit()
    Exit
EndFunc   ;==>Quit


Func GUI()
    Local $Index, $LV1, $LV2, $LV3
    $GUIhandle = GUICreate("tester", 680, 575, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) ;creates the parent window
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ;;allows resizing of full window
    $List1 = _GUICtrlListView_Create($GUIhandle, "Computer Name", 20, 35, 300, 448, -1, $LVS_EX_DOUBLEBUFFER) ;;$ES_READONLY incase you don't want to be able to select text
;~  $List1Ex = _GUIListViewEx_Init($List1, "")
    _GUICtrlListView_SetExtendedListViewStyle($List1, $LVS_EX_TWOCLICKACTIVATE)
    $List2 = _GUICtrlListView_Create($GUIhandle, "Date/Time", 355, 35, 190, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB))
;~  $List1Ex = _GUIListViewEx_Init($List2, "")
    $List3 = _GUICtrlListView_Create($GUIhandle, "Speed", 574, 35, 95, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB))
;~  $List1Ex = _GUIListViewEx_Init($List3, "")
    GUICtrlCreateLabel("Additional Info", 20, 489) ;creates the label for $List4
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    $List4 = GUICtrlCreateList("", 20, 512, 635, 40, BitOR($WS_BORDER, $WS_VSCROLL), $ES_READONLY)
    GUICtrlSetResizing($List4, $GUI_DOCKAUTO)
    GUICtrlCreateLabel("Active Connections: ", 525, 487) ;creates the label for the active connections
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    GUISetState(@SW_SHOW) ;shows the GUI window
    For $Index = 0 To 100 Step 1
        $LV1 = _GUICtrlListView_AddItem($List1, " ") ;adds a default value into $List1
        $LV2 = _GUICtrlListView_AddItem($List2, " ") ;adds a default value into $List2
        $LV3 = _GUICtrlListView_AddItem($List3, " ") ;adds a default value into $List3
    Next
EndFunc   ;==>GUI

;===========MAXIMIZE THE WINDOW TO SEE HOW THIS TRULY FUNCTIONS===============;
Func WM_SIZE($hWnd, $msg, $wParam, $lParam)
    $iWidth = BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord
    $iHeight = BitShift($lParam, 16) ; _WinAPI_HiWord
    If $lParam > $lp_Buffer Then
        _WinAPI_MoveWindow($List1, 20, 35, $iWidth - 1200, 900)
    Else
        _WinAPI_MoveWindow($List1, 20, 35, $iWidth - 400, 448)
    EndIf
    $lp_Buffer = $lParam
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

Any reply is much appreciated. :)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites



MikahS,

I would create disabled labels behind the ListViews which resize automatically and then resize the ListViews to fit the labels:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiScrollBars.au3>
#include <GUIListViewEx.au3>
#include <EditConstants.au3>

Local $List1, $List2, $List3, $List4, $lp_Buffer = 0
Local $List1Ex, $List2Ex, $List3Ex

Global $GUIhandle, $cLabel_1, $cLabel_2, $cLabel_3

GUI()

GUIRegisterMsg($WM_SIZE, "WM_SIZE")

_GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List2), $SB_BOTH, $ESB_DISABLE_BOTH)
_GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List3), $SB_BOTH, $ESB_DISABLE_BOTH)


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Quit()
    EndSwitch
WEnd

;END MAIN LINE


Func Quit()
    Exit
EndFunc   ;==>Quit


Func GUI()
    Local $Index, $LV1, $LV2, $LV3
    $GUIhandle = GUICreate("tester", 680, 575, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) ;creates the parent window
    ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ;;allows resizing of full window
    $List1 = _GUICtrlListView_Create($GUIhandle, "Computer Name", 20, 35, 300, 448, -1, $LVS_EX_DOUBLEBUFFER) ;;$ES_READONLY incase you don't want to be able to select text
    _GUICtrlListView_SetExtendedListViewStyle($List1, $LVS_EX_TWOCLICKACTIVATE)
    $cLabel_1 = GUICtrlCreateLabel("", 20, 35, 300, 448)
    GUICtrlSetState($cLabel_1, $GUI_DISABLE)
    GUICtrlSetResizing($cLabel_1,$GUI_DOCKAUTO )
    GUICtrlSetBkColor($cLabel_1, $GUI_BKCOLOR_TRANSPARENT)
    $List2 = _GUICtrlListView_Create($GUIhandle, "Date/Time", 355, 35, 190, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB))
    $cLabel_2 = GUICtrlCreateLabel("", 355, 35, 190, 450)
    GUICtrlSetState($cLabel_2, $GUI_DISABLE)
    GUICtrlSetResizing($cLabel_2,$GUI_DOCKAUTO )
    GUICtrlSetBkColor($cLabel_2, $GUI_BKCOLOR_TRANSPARENT)
    $List3 = _GUICtrlListView_Create($GUIhandle, "Speed", 574, 35, 95, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB))
    $cLabel_3 = GUICtrlCreateLabel("", 574, 35, 95, 450)
    GUICtrlSetState($cLabel_3, $GUI_DISABLE)
    GUICtrlSetResizing($cLabel_3,$GUI_DOCKAUTO )
    GUICtrlSetBkColor($cLabel_3, $GUI_BKCOLOR_TRANSPARENT)

    GUICtrlCreateLabel("Additional Info", 20, 489) ;creates the label for $List4
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    $List4 = GUICtrlCreateList("", 20, 512, 635, 40, BitOR($WS_BORDER, $WS_VSCROLL), $ES_READONLY)
    GUICtrlSetResizing($List4, $GUI_DOCKAUTO)
    GUICtrlCreateLabel("Active Connections: ", 525, 487) ;creates the label for the active connections
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    GUISetState(@SW_SHOW) ;shows the GUI window

    For $Index = 0 To 100 Step 1
        $LV1 = _GUICtrlListView_AddItem($List1, " ") ;adds a default value into $List1
        $LV2 = _GUICtrlListView_AddItem($List2, " ") ;adds a default value into $List2
        $LV3 = _GUICtrlListView_AddItem($List3, " ") ;adds a default value into $List3
    Next
EndFunc   ;==>GUI


Func WM_SIZE($hWnd, $msg, $wParam, $lParam)

    $aRet = ControlGetPos($GUIhandle, "", $cLabel_1)
    WinMove($List1, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3])
    $aRet = ControlGetPos($GUIhandle, "", $cLabel_2)
    WinMove($List2, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3])
    $aRet = ControlGetPos($GUIhandle, "", $cLabel_3)
    WinMove($List3, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3])

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE
Any use? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Any use? :huh:

M23

 

 

You are one smart cookie Melba ;)

It works perfectly as expected. Only, one minor detail.

If the window is maximized it will stay the same, and will only change sizes when you are manually resizing the window. Any thoughts?


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

MikahS,

 

You are one smart cookie Melba

Thanks. :blush:

As to the "minor detail" - I suggest looking for the maximize and restore messages and running the same function when they occur. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I tried using GUIRegisterMsg($WM_SYSCOMMAND, 'WM_SIZE'). It does the same behavior for maximizing, but tries to expand everything when it is then restored.

I must be missing something.. :geek:

EDIT: Also tried

GUIRegisterMsg(0xF030, "WM_SIZE")
GUIRegisterMsg(0xF020, "WM_SIZE")
GUIRegisterMsg(0xF120, "WM_SIZE")
Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

MikahS,

Try this - you need to wait until the window has been maximized/restored before you resize which is why I use a flag in the idle loop: ;)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiScrollBars.au3>
#include <GUIListViewEx.au3>
#include <EditConstants.au3>

Local $List1, $List2, $List3, $List4, $lp_Buffer = 0
Local $List1Ex, $List2Ex, $List3Ex

Global $GUIhandle, $cLabel_1, $cLabel_2, $cLabel_3

Global $bSysMsg = False

GUI()

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")
GUIRegisterMsg($WM_SYSCOMMAND, "_WM_SYSCOMMAND")

_GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List2), $SB_BOTH, $ESB_DISABLE_BOTH)
_GUIScrollBars_EnableScrollBar(ControlGetHandle("", "", $List3), $SB_BOTH, $ESB_DISABLE_BOTH)


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Quit()
    EndSwitch

    If $bSysMsg Then
        $bSysMsg = False
        _Resize_ListViews()
    EndIf

WEnd

;END MAIN LINE


Func Quit()
    Exit
EndFunc   ;==>Quit


Func GUI()
    Local $Index, $LV1, $LV2, $LV3
    $GUIhandle = GUICreate("tester", 680, 575, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) ;creates the parent window
    ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ;;allows resizing of full window
    $List1 = _GUICtrlListView_Create($GUIhandle, "Computer Name", 20, 35, 300, 448, -1, $LVS_EX_DOUBLEBUFFER) ;;$ES_READONLY incase you don't want to be able to select text
    _GUICtrlListView_SetExtendedListViewStyle($List1, $LVS_EX_TWOCLICKACTIVATE)
    $cLabel_1 = GUICtrlCreateLabel("", 20, 35, 300, 448)
    GUICtrlSetState($cLabel_1, $GUI_DISABLE)
    GUICtrlSetResizing($cLabel_1,$GUI_DOCKAUTO )
    GUICtrlSetBkColor($cLabel_1, $GUI_BKCOLOR_TRANSPARENT)
    $List2 = _GUICtrlListView_Create($GUIhandle, "Date/Time", 355, 35, 190, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB))
    $cLabel_2 = GUICtrlCreateLabel("", 355, 35, 190, 450)
    GUICtrlSetState($cLabel_2, $GUI_DISABLE)
    GUICtrlSetResizing($cLabel_2,$GUI_DOCKAUTO )
    GUICtrlSetBkColor($cLabel_2, $GUI_BKCOLOR_TRANSPARENT)
    $List3 = _GUICtrlListView_Create($GUIhandle, "Speed", 574, 35, 95, 450, -1, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FLATSB))
    $cLabel_3 = GUICtrlCreateLabel("", 574, 35, 95, 450)
    GUICtrlSetState($cLabel_3, $GUI_DISABLE)
    GUICtrlSetResizing($cLabel_3,$GUI_DOCKAUTO )
    GUICtrlSetBkColor($cLabel_3, $GUI_BKCOLOR_TRANSPARENT)

    GUICtrlCreateLabel("Additional Info", 20, 489) ;creates the label for $List4
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    $List4 = GUICtrlCreateList("", 20, 512, 635, 40, BitOR($WS_BORDER, $WS_VSCROLL), $ES_READONLY)
    GUICtrlSetResizing($List4, $GUI_DOCKAUTO)
    GUICtrlCreateLabel("Active Connections: ", 525, 487) ;creates the label for the active connections
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    GUISetState(@SW_SHOW) ;shows the GUI window

    For $Index = 0 To 100 Step 1
        $LV1 = _GUICtrlListView_AddItem($List1, " ") ;adds a default value into $List1
        $LV2 = _GUICtrlListView_AddItem($List2, " ") ;adds a default value into $List2
        $LV3 = _GUICtrlListView_AddItem($List3, " ") ;adds a default value into $List3
    Next
EndFunc   ;==>GUI


Func _WM_SIZE($hWnd, $msg, $wParam, $lParam)
    _Resize_ListViews()
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

Func _WM_SYSCOMMAND($hWnd, $msg, $wParam, $lParam)

    Const $SC_MAXIMIZE = 0xF030
    Const $SC_RESTORE = 0xF120

    Switch $wParam
        Case $SC_MAXIMIZE, $SC_RESTORE
            $bSysMsg = True
    EndSwitch

EndFunc

Func _Resize_ListViews()
    $aRet = ControlGetPos($GUIhandle, "", $cLabel_1)
    WinMove($List1, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3])
    $aRet = ControlGetPos($GUIhandle, "", $cLabel_2)
    WinMove($List2, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3])
    $aRet = ControlGetPos($GUIhandle, "", $cLabel_3)
    WinMove($List3, "", $aRet[0], $aRet[1], $aRet[2], $aRet[3])
EndFunc
M23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Ah, hit the nail square on the head. ;)

Thank you for all your help Melba!

As always, much appreciated. :D


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

MikahS,

My pleasure as always. :)

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

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  
Followers 0

  • Similar Content

    • 0Ethan0
      By 0Ethan0
      Ahoy Autoit Community!
      After many trials and errors I am unable to solve a problem I am facing and would appreciate any kind of input or better yet a solution 
      The Premise: An embeded slideshow viewer that runs after double-clicking an item in a ListView (each item will generate a different slideshow images).
      The Setup: GUI with a ListView Control and a simple exit button.
      The Issue: Once double clicked the slide plays however the GUI "locks"/non responsive until the slide is over. Same thing if I click on the "Test" button.
      The Culprit: I believe since it's in the images loop it can't accept any other commands until that loop is over.
      The Wish: I want to be able to use the GUI functions (selecting other items, clicking on button etc.) while the slideshow plays.
      The Code (stripped and simplified as much as I could):
      #include <GuiListView.au3> #include <File.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) HotKeySet("{Esc}", "_Exit") Global $c=0 Global $ssGDI[3], $ssGraphic[2], $ssImage Global Const $bg_color = "000000" Global Const $ssW = 480, $ssH = 320 Global $aFiles = _FileListToArrayRec("d:\testStage\", "*.jpg;*.png;*.bmp;*.gif;*.JPG;*.PNG;*.BMP;*.GIF", $FLTAR_FILES, $FLTAR_NORECUR ,$FLTAR_SORT ,$FLTAR_FULLPATH ) $guiW = 1200 $guiH = 726 $mainWindow = GUICreate("Slideshow Viewer", $guiW, $guiH, -1, -1, $WS_POPUP) $Button1 = GUICtrlCreateButton("Exit", 0, 0, 50, 50) GUICtrlSetOnEvent($Button1, "_Exit") $Button1 = GUICtrlCreateButton("Test", 60, 0, 50, 50) GUICtrlSetOnEvent($Button1, "Test") Global $ListView = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280) _GUICtrlListView_SetColumnWidth ($ListView, 0, 100) _GUICtrlListView_SetColumnWidth ($ListView, 1, 100) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlCreateListViewItem("Name 1|Category 1", $ListView) GUICtrlCreateListViewItem("Name 2|Category 2", $ListView) screenshotWidgetInit($ssW,$ssH, 690, 100) GUISetState(@SW_SHOW, $mainWindow) GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _Exit() EndSwitch WEnd Func Test() For $k = 1 To UBound($aFiles) - 1 screenshotWidgetTransition($aFiles[$k]) Next EndFunc Func ListView_Click() ConsoleWrite("Left Click") EndFunc Func ListView_DoubleClick() ConsoleWrite("Double Left Click") Test() EndFunc Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $ListView Select Case $event = $NM_CLICK ListView_Click () Case $event = $NM_DBLCLK ListView_DoubleClick () EndSelect EndSelect Return $GUI_RUNDEFMSG EndFunc Func screenshotWidgetTransition($image, $delay = 0, $speed = 1, $sleep = 2000) Local $a, $d = $c, $iX, $iY $ssImage = _GDIPlus_ImageLoadFromFile($image) $iX = _GDIPlus_ImageGetWidth($ssImage) $iY = _GDIPlus_ImageGetHeight($ssImage) $FDesktop=$ssH/$ssW $Fact =1 If $iX > $ssW And $FDesktop > ($iY/$iX) Then $Fact=$ssW/$iX ElseIf $iY > $ssH Then $Fact=$ssH/$iY EndIf $H1 = Round(($Fact * $iY),0) $W1 = Round(($Fact * $iX),0) _GDIPlus_GraphicsDrawImageRect($ssGraphic[$d], $ssImage,($ssW - $W1)/2, ($ssH - $H1) / 2,$W1,$H1) WinSetTrans($ssGDI[$d], "", 0) WinSetOnTop($ssGDI[$d], "", 1) For $a = 0 To 254 Step $speed WinSetTrans($ssGDI[$d], "", $a) Sleep($delay) Next WinSetTrans($ssGDI[$d], "", 254) WinSetOnTop($ssGDI[Not ($d)], "", 0) WinSetTrans($ssGDI[Not ($d)], "", 0) _GDIPlus_GraphicsClear($ssGraphic[Not ($d)]) $c = 1 - $d _GDIPlus_ImageDispose ($ssImage) ; very important to realease the pics Sleep($sleep) EndFunc ;==>screenshotWidgetTransition Func screenshotWidgetInit($ssW,$ssH,$ssX,$ssY) $ssGDI[2] = GUICreate("", $ssW, $ssH, $ssX, $ssY, $WS_POPUP, $WS_EX_MDICHILD, $mainWindow) $ssGDI[0] = GUICreate("", $ssW, $ssH, 3, 3, $WS_POPUP, $WS_EX_MDICHILD, $ssGDI[2]) $ssGDI[1] = GUICreate("", $ssW, $ssH, 3, 3, $WS_POPUP, $WS_EX_MDICHILD, $ssGDI[2]) ; GUISetBkColor("0x" & $bg_color, $ssGDI[2]) GUISetState(@SW_SHOW, $ssGDI[2]) GUISetState(@SW_SHOW, $ssGDI[0]) GUISetState(@SW_SHOW, $ssGDI[1]) WinSetTrans($ssGDI[0], "", 0) WinSetTrans($ssGDI[1], "", 0) _GDIPlus_Startup() $ssGraphic[0] = _GDIPlus_GraphicsCreateFromHWND($ssGDI[0]) $ssGraphic[1] = _GDIPlus_GraphicsCreateFromHWND($ssGDI[1]) _GDIPlus_GraphicsClear($ssGraphic[0], "0xFF" & $bg_color) _GDIPlus_GraphicsClear($ssGraphic[1], "0xFF" & $bg_color) EndFunc ;==>screenshotWidgetInit Func _Exit() _GDIPlus_ImageDispose($ssImage) _GDIPlus_GraphicsDispose($ssGraphic[0]) _GDIPlus_GraphicsDispose($ssGraphic[1]) GUIDelete($ssGDI[0]) GUIDelete($ssGDI[1]) GUIDelete($ssGDI[2]) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit I hope someone can shed light on this; perhaps a different approach is needed?
      Thank you in advance!
      P.S.
      The script is patched from different scripts of different users in the forum - thank you again users!
    • Skeletor
      By Skeletor
      MS Splash Screens
      The office 2016/17 office suite has made many people turn heads with its functions and especially their splash screen.
      I now present to you, the MS Style Splash Screen. For Rookies, Novices and anyone who wants a ready made splash screen for your gui application.

      You can now download it and also try it out yourself.
      You have three colors to choose from:
      Blue
      Red
      Green
      All three colours are from the famous programs.
      I also included the KODA form to you can have freedom with this splash screen.
      Note: the KODA form does not have the three colours as well as the correct blue. 

      Have fun and enjoy.
      Note:
      I will update the splash to add the automated 3 dots animation at a later stage. 
       
       
    • Skeletor
      By Skeletor
      A gui splash screen. Themed after the famous MS Office Suite.
      Three colours to choose from, Red, Blue and Green.
      You can change the labels to your own application.

      Also bundled with this is the KODA form. So you can open up and see the basic structure of this splash screen.
       
      Splash Screen GUI.zip
    • BlazerV60
      By BlazerV60
      Hello all,
      I've been trying to figure out how to launch Google Chrome in the background (hidden) but it doesn't seem possible. I've tried the following methods:
      ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "", "", "", @SW_HIDE) Also I've tried:
      ShellExecute(@ComSpec, "/c start chrome.exe","","",@SW_HIDE) Lastly I tried:
      RunWait('"'&@ProgramFilesDir&'\Google\Chrome\Application\chrome.exe" --silent-launch',@ScriptDir)  
      But all of them launch my chrome browser without hiding it. Does anyone know a workaround for this or if AutoIT just can't Chrome? 
      Bonus points if you know how to make it launch chrome hidden and make it go to https://www.autoitscript.com
       
      Thank you,
      Brian