Jump to content

Recommended Posts

Posted (edited)

Really nice UDF.

Seems to fit my needs.

 

I have a GUI in which I am enabling/showing more or less controls and therefore the GUI will stretch or shrink, obviously.

I had something working already, but I had a strange Bug.

I hope with your UDF I'll avoid that bug. I'll let you know if I will happy or get into trouble again. :geek:

Edited by AndyK70
  • Moderators
Posted (edited)

AndyK70,

Thanks - but you should have read >a little further before posting. ;)

But you are only 4 years late. :D

M23

Edit:

In case anyone was wondering, AndyK70's original post was suggesting a way to get the UDF to respond to mousewheel movement.

Edited by Melba23

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

 

  • Moderators
Posted

AndyK70,

Glad you like it. :)

 

I have a GUI in which I am enabling/showing more or less controls and therefore the GUI will stretch or shrink, obviously

You may also find my GUIExtender UDF of interest - it allows you to display/hide sections of a GUI as required. ;)

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

 

Posted (edited)

Yepp, that's my thought, too.

Now I'm at Post #30 where you present _GUIScrollbars_Locate_Ctrl() and my face grin up brightly.

You are my hero! You nailed it years before I needed it, I'm so happy.

Thank you man!

Great work!

(Even if it is not included in the _GUIScrollbars_Size UDF, now I know how to handle it)

continuing to read the thread, don't want to miss anything else :D

Edited by AndyK70
  • 3 weeks later...
Posted (edited)

Dr Melba23, could you fix, please, an error, when using

$WS_OVERLAPPEDWINDOW

style.

The components, are resizing with gui.

And when scroll down window, and then resize, all components shifts down on size of scroll position.

plz

br damien2008

Edited by damien2008
  • Moderators
Posted

damien2008,

Welcome to the AutoIt forums. :)

Please provide a reproducer script so I can see what is happening. ;)

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

 

Posted (edited)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

#include "GUIScrollbars_Size.au3"

Global $ahLabels[100] = [0]

$hGUI = GUICreate("Test", 300, 300, -1, -1, $WS_OVERLAPPEDWINDOW)

GUISetState()

$aRet = _GUIScrollbars_Size(0, 550, 300, 300)
If @error Then
    ConsoleWrite($aRet & " - " & @error & " - " & @Extended & @CRLF)
Else
    For $i = 0 To 5
        ConsoleWrite($aRet[$i] & @CRLF)
    Next
EndIf

GUIRegisterMsg($WM_VSCROLL, "_Scrollbars_WM_VSCROLL")

_GUIScrollBars_Init($hGUI)
_GUIScrollBars_ShowScrollBar($hGUI, $SB_VERT, True)
_GUIScrollBars_ShowScrollBar($hGUI, $SB_HORZ, False)
_GUIScrollBars_SetScrollInfoPage($hGUI, $SB_VERT, $aRet[2])
_GUIScrollBars_SetScrollInfoMax($hGUI, $SB_VERT, $aRet[3])

$hButton = GUICtrlCreateButton("Change number of labels", 10, 10, 265, 30)

_Draw_Labels(10)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_RESTORE
            _GUIScrollbars_Restore($hGUI, True, False)
        Case $hButton
            Do
                $iCount = Number(InputBox("Resize scroll area", "Select number of labels to display (min 6)", "", "", 240, 130))
            Until $iCount > 5

             _Draw_labels($iCount)
            $aRet = _GUIScrollbars_Size(0, ($iCount + 1) * 50, 300, 300)
            _GUIScrollBars_SetScrollInfoPage($hGUI, $SB_VERT, $aRet[2])
            _GUIScrollBars_SetScrollInfoMax($hGUI, $SB_VERT, $aRet[3])
    EndSwitch

WEnd

Func _Draw_labels($iCount)

    ConsoleWrite($iCount & " - " & $ahLabels[0] & @CRLF)

    GUISwitch($hGUI)

    If $iCount > $ahLabels[0] Then
        For $i = $ahLabels[0] + 1 To $iCount
            ConsoleWrite("Add " & $i & @CRLF)
            $ahLabels[$i] = GUICtrlCreateLabel($i, 10, $i * 50, 265, 40)
            GUICtrlSetBkColor(-1, 0xFF8080)
            GUICtrlSetFont(-1, 18)
        Next
    Else
        For $i = $iCount + 1 To $ahLabels[0]
            ConsoleWrite("Del " & $i & @CRLF)
            GUICtrlDelete($ahLabels[$i])
        Next
    EndIf
    $ahLabels[0] = $iCount

EndFunc

Func _Scrollbars_WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)

    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $iIndex = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos
    Global $aSB_WindowInfo
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $iIndex = $x
            $yChar = $aSB_WindowInfo[$iIndex][3]
            ExitLoop
        EndIf
    Next
    If $iIndex = -1 Then Return 0

    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP
            DllStructSetData($tSCROLLINFO, "nPos", $Min)
        Case $SB_BOTTOM
            DllStructSetData($tSCROLLINFO, "nPos", $Max)
        Case $SB_LINEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
        Case $SB_LINEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
        Case $SB_PAGEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
        Case $SB_PAGEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
        Case $SB_THUMBTRACK
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_Scrollbars_WM_VSCROLL

Snymok22.png

br damien2008

autoit version 3.3.8.1

Edited by damien2008
  • Moderators
Posted

damien2008,

The UDF was not designed to deal with resizable GUIs - so what you see does not surprise me. I am afraid I am not going to add resizeable GUI support either - it was hard enough writing the UDF to cope with scrollbars in fixed size GUIs. 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

 

  • 3 weeks later...
Posted

Nice UDF.

but when I use GUIScrollbars_Size_Example_1.au3

then i get this:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "Z:\TOOLs\Macro\PROGRAMY\__UDF\_SCROLLBARS\GUIScrollbars_Size_Example_1.au3" /UserParams    
+>10:12:31 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0   Keyboard:00000415  OS:WIN_7/Service Pack 1  CPU:X64 OS:X86    Environment(Language:0415)
+>         SciTEDir => C:\Program Files\AutoIt3\SciTE   UserDir => C:\Users\user\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\user\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.13.0)  from:C:\Program Files\AutoIt3  input:Z:\TOOLs\Macro\PROGRAMY\__UDF\_SCROLLBARS\GUIScrollbars_Size_Example_1.au3
"Z:\TOOLs\Macro\PROGRAMY\__UDF\_SCROLLBARS\GUIScrollbars_Size_Example_1.au3"(250,38) : warning: $aSB_WindowInfo: possibly used before declaration.
    For $x = 0 To UBound($aSB_WindowInfo)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"Z:\TOOLs\Macro\PROGRAMY\__UDF\_SCROLLBARS\GUIScrollbars_Size_Example_1.au3"(250,38) : error: $aSB_WindowInfo: undeclared global variable.
    For $x = 0 To UBound($aSB_WindowInfo)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Z:\TOOLs\Macro\PROGRAMY\__UDF\_SCROLLBARS\GUIScrollbars_Size_Example_1.au3 - 1 error(s), 1 warning(s)
!>10:12:31 AU3Check ended. Press F4 to jump to next error.rc:2
+>10:12:31 AutoIt3Wrapper Finished.
>Exit code: 2    Time: 0.6418

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

  • Moderators
Posted

mLipok,

That variable has been renamed within the main GUIScrollbars include since the last UDF release - change all instances to $__g_aSB_WindowInfo and all should be well. I will release a new version of the UDF this weekend when I get back to my main machine and a decent internet connection. :)

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

 

  • Moderators
Posted

[New Version] - 9 Aug 14

Added: Ability to use the cursor keys to scroll if required.

Fixed: Links to variables in the underlying GUIScrollbars UDF.

New UDFs, examples and zip file in first post. smile.png

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

 

  • 4 weeks later...
Posted

I had a small problem with GUI. I added Scroll bar to the GUI. Later i was trying to delete ListView Control and add it back with less or more columns dynamically. It works fine. But if i scroll the GUI screen using scroll bar a little. The Listview control also moves to the right next time when it get created.

Posted

 

I had a small problem with GUI. I added Scroll bar to the GUI. Later i was trying to delete ListView Control and add it back with less or more columns dynamically. It works fine. But if i scroll the GUI screen using scroll bar a little. The Listview control also moves to the right next time when it get created.

Deleting the listview seems a little extreme... You should be able to add and remove columns from the listview using the GUIListView.au3 functions (in the helpfile under User Defined Functions Reference -> GUI Reference -> GUIListView Reference or something like that)

  • Moderators
Posted

Mukeshjaglan,

I agree with Mat that the easiest solution is probably to alter the ListView rather then delete and recreate it. But if you must go that way then here is how to get the new ListView in the same position as before:

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

#include "GUIScrollbars_Ex.au3"

$hGUI = GUICreate("Test", 500, 500)
GUISetBkColor(0xFFCCCC)

$cButton_1 = GUICtrlCreateButton("Recreate LV", 10, 450, 80, 30)

GUISetState()

$hAperture = GUICreate("", 400, 400, 50, 10, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
GUISetBkColor(0xCCFFCC)

$cLV = _CreateLV(50, 50)

 _GUIScrollbars_Generate($hAperture, 1000)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton_1
            ; Get current horizontal scroll position
            $iPos = _GUIScrollBars_GetScrollPos($hAperture, $SB_HORZ)
            ; Move to full left scroll
            _GUIScrollBars_SetScrollInfoPos($hAperture, $SB_HORZ, 0)
            Sleep(1000) ; These Sleep lines are just to slow the process for visualisation, they are not otherwise required
            ; Delete ListView
            GUICtrlDelete($cLV)
            Sleep(1000)
            ; Recreate ListView
            _CreateLV(50, 50)
            Sleep(1000)
            ; Scroll back to previous position
            _GUIScrollBars_SetScrollInfoPos($hAperture, $SB_HORZ, $iPos)
    EndSwitch

WEnd


Func _CreateLV($iX, $iY)

    $cListView = GUICtrlCreateListView("", $iX, $iY, 900, 300)
    GUICtrlSetBkColor($cListView, 0xCCCCFF)
    For $i = 0 To 8
        _GUICtrlListView_AddColumn ($cListView, "Column " & $i, 100)
    Next

    Return $cListView

EndFunc
All clear? :)

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

 

Posted (edited)

Thanks Melba23 and Mat, I will give it a try today and let you know how it goes..

Actually deleting data in the list view is slower to me then deleting / Recreating the listview control. Since my application is working as it is, i would like to keep the drastic code changes as the secondary option..

Edited by Mukeshjaglan
Posted

Thanks Melba23 and Mat, I will give it a try today and let you know how it goes..

Actually deleting data in the list view is slower to me then deleting / Recreating the listview control. Since my application is working as it is, i would like to keep the drastic code changes as the secondary option..

That's really odd. Are you using BeginUpdate and EndUpdate? They tend to speed things up a lot.

If its working and doesn't look odd or cause any other issues then don't change it, but it's worth looking at how to manipulate listviews properly.

Posted (edited)

Hello,

there is some code you can check:

- in that example parent GUI is not appear

- but in case you'll resize main one it shows and work fine

please help me fix it

#include <array.au3>#include <date.au3>#include <WinAPI.au3>#include <GUIConstantsEx.au3>#include <GuiStatusBar.au3>#include <GuiToolbar.au3>#include <TabConstants.au3>#include <ToolbarConstants.au3>#include <WindowsConstants.au3>#include "GUIListViewEx.au3"#include "DateCalc.au3"#include <DateTimeConstants.au3>#include <StaticConstants.au3>#include "GUIScrollbars_Ex.au3"global $LostPackagemsglist$Form1 = GUICreate("Form1", 700, 421, 100, 168, $WS_OVERLAPPEDWINDOW)GUICtrlSetResizing(-1, $GUI_DOCKMENUBAR) $MenuItem4 = GUICtrlCreateMenu("MenuItem4") $MenuItem5 = GUICtrlCreateMenu("MenuItem5") $MenuItem6 = GUICtrlCreateMenu("MenuItem6") $MenuItem7 = GUICtrlCreateMenu("MenuItem7")$ToolBar1 = _GUICtrlToolbar_Create($Form1, 0) _GUICtrlToolbar_AddButton($ToolBar1, 0, 0, 0) _GUICtrlToolbar_AddButton($ToolBar1, 0, 1, 0) _GUICtrlToolbar_AddButton($ToolBar1, 0, 2, 0) _GUICtrlToolbar_AddButton($ToolBar1, 0, 3, 0) _GUICtrlToolbar_AddButton($ToolBar1, 0, 4, 0) _GUICtrlToolbar_AddButton($ToolBar1, 0, 5, 0)$InformationTab = GUICtrlCreateTab(8, 27, 684, 257, $TCS_MULTILINE, $TCS_EX_FLATSEPARATORS) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) $LostPackagemsglistTab = GUICtrlCreateTabItem("LostPackage") $ApplyLostPackageCalView = GUICtrlCreateButton("Apply", 487, 65, 50, 25) $LostDatamsglistTab = GUICtrlCreateTabItem("View LostData") $TabSheet2 = GUICtrlCreateTabItem("Edit LostData")$darectionCalListEdit = _GUICtrlListView_Create($Form1, "", 13, 98, 672, 150) ;,$LVS_SORTDESCENDING)WinSetState($darectionCalListEdit, "", @SW_HIDE)_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)$TabSheet3 = GUICtrlCreateTabItem("TabSheet3")$TabSheet4 = GUICtrlCreateTabItem("TabSheet4")GUIRegisterMsg($WM_SIZE, "WM_SIZE")GUISetState(@SW_SHOW)Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) Global $iHeight, $iWidth, $WinSize, $WinPos, $WinClientCoord[2] $iWidth = _WinAPI_LoWord($lParam) ;BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord $iHeight = _WinAPI_HiWord($lParam) ;BitShift($lParam, 0xFFFF) ; _WinAPI_HiWord $WinPos = WinGetPos ($Form1) $WinClientCoord[0] = ($WinPos[2]-$iWidth)/2 $WinClientCoord[1]= $WinPos[3]-$iHeight-$WinClientCoord[0] $WinClientCoord[0]=$WinPos[0]+$WinClientCoord[0] $WinClientCoord[1]=$WinPos[1]+$WinClientCoord[1] _WinAPI_MoveWindow($darectionCalListEdit, 13, 98, $iWidth - 28, $iHeight - 250) If IsHWnd($LostPackagemsglist) Then _WinAPI_MoveWindow($LostPackagemsglist, $WinClientCoord[0]+13, $WinClientCoord[1]+98, $iWidth - 28, $iHeight - 250) EndIf Return $GUI_RUNDEFMSGEndFuncWhile 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $InformationTab ; We need to hide/show the UDF LV - AutoIt looks after the built-in version Select Case GUICtrlRead($InformationTab) = 0 WinSetState($darectionCalListEdit, "", @SW_HIDE) If WinGetState($LostPackagemsglist) == 5 Then GUISetState(@SW_SHOW,$LostPackagemsglist) EndIf Case GUICtrlRead($InformationTab) = 1 WinSetState($darectionCalListEdit, "", @SW_HIDE) If WinGetState($LostPackagemsglist) == 7 Then GUISetState(@SW_HIDE,$LostPackagemsglist) EndIf Case GUICtrlRead($InformationTab) = 2 If WinGetState($LostPackagemsglist) == 7 Then GUISetState(@SW_HIDE,$LostPackagemsglist) EndIf WinSetState($darectionCalListEdit, "", @SW_SHOW) EndSelect Case $ApplyLostPackageCalView LoadLostPackagemsglist() EndSwitchWEndFunc LoadLostPackagemsglist() If Not IsHWnd($LostPackagemsglist) Then ;==========================LostPackagemsglistArray====== global $LostPackagemsglistArray Local $LostPackage1,$LostPackage2,$LostPackage3,$LostPackage4,$LostPackage5,$LostPackage6 ;==========================Createmsglist=============== global $LostPackagemsglist = GUICreate("",$iWidth-28, $iHeight-250, 7, 93, $WS_POPUP, $WS_EX_MDICHILD, $Form1) GUISetState(@SW_SHOW) _GUIScrollbars_Generate($LostPackagemsglist, $iWidth+1500, $iHeight+1500,0,0, True) If @error Then MsgBox(16, "Error", "Scrollbar generation failed") Exit EndIf GUICtrlCreateLabel("", 0, 0, 500, 500) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateLabel("", 500, 500, 500, 500) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateLabel("", 0, 500, 500, 500) GUICtrlSetBkColor(-1, 0x0000FF) GUICtrlCreateLabel("", 500, 0, 500, 500) GUICtrlSetBkColor(-1, 0x0000FF) EndIfMsgBox(0, '', WinGetState($LostPackagemsglist))EndFunc
May be there is a way to force resize of it some how

_WinAPI_MoveWindow to the end of the LoadLostPackagemsglist() function works

 

GUIRegisterMsg($WM_SIZE, "WM_SIZE")GUISetState(@SW_SHOW)Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) Global $iHeight, $iWidth, $WinSize, $WinPos, $WinClientCoord[2] $iWidth = _WinAPI_LoWord($lParam) ;BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord $iHeight = _WinAPI_HiWord($lParam) ;BitShift($lParam, 0xFFFF) ; _WinAPI_HiWord $WinPos = WinGetPos ($Form1) $WinClientCoord[0] = ($WinPos[2]-$iWidth)/2 $WinClientCoord[1]= $WinPos[3]-$iHeight-$WinClientCoord[0] $WinClientCoord[0]=$WinPos[0]+$WinClientCoord[0] $WinClientCoord[1]=$WinPos[1]+$WinClientCoord[1] _WinAPI_MoveWindow($RateCalListEdit, 13, 98, $iWidth - 28, $iHeight - 250) If IsHWnd($Reservationcalendar) Then _WinAPI_MoveWindow($Reservationcalendar, $WinClientCoord[0]+13, $WinClientCoord[1]+98, $iWidth - 28, $iHeight - 250) EndIf Return $GUI_RUNDEFMSGEndFunc_WinAPI_MoveWindow($Form1, $WinPos[0], $WinPos[1], $WinPos[2]+1, $WinPos[3]+1)
So there we go Edited by Melba23
Multiple posts merged - sorry sbout the code
  • Moderators
Posted

MarkStaver,

Welcome to the AutoIt forums. :)

 

there is some code you can check

I take it English is not your mother tongue! :P

The reason your child GUI did not appear was that you only ever set the $iWidth & $iHeight values as Local variables in the WM_SIZE handler - so the child was created outside the visible area of the parent. Making these variables Global and giving them an initial value solved that. :)

However, I have significantly modified your script as my UDF does not work with resizeable windows. So we look for the beginning and end of a SIZE event and destroy and recreate the child each time - that way the scrollbars are correct for each size:

#include <array.au3>
#include <date.au3>
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <GuiToolbar.au3>
#include <TabConstants.au3>
#include <ToolbarConstants.au3>
#include <WindowsConstants.au3>
#include "GUIListViewEx.au3"
;#include "DateCalc.au3"
#include <DateTimeConstants.au3>
#include <StaticConstants.au3>
#include "GUIScrollbars_Ex.au3"

Global $LostPackagemsglist = 0, $iWidth = 700, $iHeight = 421

Global $Form1 = GUICreate("Form1", 700, 421, 100, 168, $WS_OVERLAPPEDWINDOW)

GUICtrlSetResizing(-1, $GUI_DOCKMENUBAR)
$MenuItem4 = GUICtrlCreateMenu("MenuItem4")
$MenuItem5 = GUICtrlCreateMenu("MenuItem5")
$MenuItem6 = GUICtrlCreateMenu("MenuItem6")
$MenuItem7 = GUICtrlCreateMenu("MenuItem7")
$ToolBar1 = _GUICtrlToolbar_Create($Form1, 0)
_GUICtrlToolbar_AddButton($ToolBar1, 0, 0, 0)
_GUICtrlToolbar_AddButton($ToolBar1, 0, 1, 0)
_GUICtrlToolbar_AddButton($ToolBar1, 0, 2, 0)
_GUICtrlToolbar_AddButton($ToolBar1, 0, 3, 0)
_GUICtrlToolbar_AddButton($ToolBar1, 0, 4, 0)
_GUICtrlToolbar_AddButton($ToolBar1, 0, 5, 0)

Global $InformationTab = GUICtrlCreateTab(8, 27, 684, 257, $TCS_MULTILINE, $TCS_EX_FLATSEPARATORS)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)

$LostPackagemsglistTab = GUICtrlCreateTabItem("LostPackage")

$ApplyLostPackageCalView = GUICtrlCreateButton("Apply", 487, 65, 50, 25)

$LostDatamsglistTab = GUICtrlCreateTabItem("View LostData")

$TabSheet2 = GUICtrlCreateTabItem("Edit LostData")

$TabSheet3 = GUICtrlCreateTabItem("TabSheet3")

$TabSheet4 = GUICtrlCreateTabItem("TabSheet4")

GUICtrlCreateTabItem("") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Do not forget to close the tab definiton

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< No need to create inside the tab structure as it is a UDF control and we have to look after it
$darectionCalListEdit = _GUICtrlListView_Create($Form1, "", 13, 98, 672, 150) ;,$LVS_SORTDESCENDING)
ControlHide($Form1, "", $darectionCalListEdit)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Peter", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Paul", 83)
_GUICtrlListView_AddColumn($darectionCalListEdit, "Mary End", 83)

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_ENTERSIZEMOVE, "_WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_EXITSIZEMOVE, "_WM_EXITSIZEMOVE")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $InformationTab
            ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< A rather simpler way to hide/show the 2 special items!!
            Switch GUICtrlRead($InformationTab)
                Case 0
                    ControlHide($Form1, "", $darectionCalListEdit)
                    If IsHWnd($LostPackagemsglist) Then GUISetState(@SW_SHOW, $LostPackagemsglist)
                Case 2
                    ControlShow($Form1, "", $darectionCalListEdit)
                    If IsHWnd($LostPackagemsglist) Then GUISetState(@SW_HIDE, $LostPackagemsglist)
                Case Else
                    ControlHide($Form1, "", $darectionCalListEdit)
                    If IsHWnd($LostPackagemsglist) Then GUISetState(@SW_HIDE, $LostPackagemsglist)
            EndSwitch
        Case $ApplyLostPackageCalView
            LoadLostPackagemsglist()
    EndSwitch
WEnd


Func LoadLostPackagemsglist()
    ;==========================LostPackagemsglistArray======
    Global $LostPackagemsglistArray
    Local $LostPackage1, $LostPackage2, $LostPackage3, $LostPackage4, $LostPackage5, $LostPackage6
    ;==========================Createmsglist===============
    $LostPackagemsglist = GUICreate("", $iWidth - 28, $iHeight - 250, 7, 93, $WS_POPUP, $WS_EX_MDICHILD, $Form1)
    GUISetState(@SW_SHOW)
    _GUIScrollbars_Generate($LostPackagemsglist, $iWidth + 1500, $iHeight + 1500, 0, 0, True)
    If @error Then
        MsgBox(16, "Error", "Scrollbar generation failed")
        Exit
    EndIf
    GUICtrlCreateLabel("", 0, 0, 500, 500)
    GUICtrlSetBkColor(-1, 0x00FF00)
    GUICtrlCreateLabel("", 500, 500, 500, 500)
    GUICtrlSetBkColor(-1, 0x00FF00)
    GUICtrlCreateLabel("", 0, 500, 500, 500)
    GUICtrlSetBkColor(-1, 0x0000FF)
    GUICtrlCreateLabel("", 500, 0, 500, 500)
    GUICtrlSetBkColor(-1, 0x0000FF)
    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Hide button to prevent multiple creations
    GUICtrlSetState($ApplyLostPackageCalView, $GUI_HIDE)
EndFunc   ;==>LoadLostPackagemsglist

Func _WM_ENTERSIZEMOVE($hWnd, $Msg, $wParam, $lParam) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ; Has the child been created?
    If IsHWnd($LostPackagemsglist) Then
        ; If so delete
        GUIDelete($LostPackagemsglist)
        ; And set placeholder value to indicate we need to recreate it
        $LostPackagemsglist = 99
    EndIf
    ; Hide the ListView
    ControlHide($Form1, "", $darectionCalListEdit)
EndFunc

Func _WM_EXITSIZEMOVE($hWnd, $Msg, $wParam, $lParam) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ; Get the new size
    Local $aSize = WinGetClientSize($Form1)
    $iWidth = $aSize[0]
    $iHeight = $aSize[1]
    ; Do we need to recreate the child?
    If $LostPackagemsglist = 99 Then
        LoadLostPackagemsglist()
    EndIf
    ; Reset the ListView
    _WinAPI_MoveWindow($darectionCalListEdit, 13, 98, $iWidth - 28, $iHeight - 250)
    ; Show if the tab is selected
    If GUICtrlRead($InformationTab) = 2 Then
        ControlShow($Form1, "", $darectionCalListEdit)
    EndIf
EndFunc
Please ask if you have any questions about what I have done or why I have done it. :)

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

 

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
  • Recently Browsing   0 members

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