Jump to content

Recommended Posts

Posted (edited)

WOW

THANK YOU!!!!

You answered about five questions I was needed to fix at once ;)

My Russian and Czech much butter wink.png

I'll keep my resizing, that is part of the code so destruction and recreation cause to many operations including external.

"Apply" button created on $Form1 and it destructing parent GUI, loading data recreating new so there is no reason to hide it.

Once again thank you.

#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, $LostPackagemsglist1 = 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")
;~ GUIRegisterMsg($WM_SIZE, "WM_SIZE")

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()
        Case $GUI_EVENT_MAXIMIZE ;<================================wlth that butter 
            If IsHWnd($LostPackagemsglist) Then
            ; If so delete
            GUIDelete($LostPackagemsglist)
            $LostPackagemsglist1 = 99
            EndIf
            Local $aSize = WinGetClientSize($Form1)
            $iWidth = $aSize[0]
            $iHeight = $aSize[1]
            If $LostPackagemsglist1 = 99 Then
            LoadLostPackagemsglist()
            EndIf
            _WinAPI_MoveWindow($darectionCalListEdit, 13, 98, $iWidth - 28, $iHeight - 250)
            If GUICtrlRead($InformationTab) <> 0 Then
                GUISetState(@SW_HIDE, $LostPackagemsglist)
                EndIf
            If GUICtrlRead($InformationTab) = 2 Then
                ControlShow($Form1, "", $darectionCalListEdit)
            EndIf
        Case $GUI_EVENT_RESTORE ;<================================wlth that butter 
            If IsHWnd($LostPackagemsglist) Then
            ; If so delete
            GUIDelete($LostPackagemsglist)
            $LostPackagemsglist1 = 99
            EndIf
            Local $aSize = WinGetClientSize($Form1)
            $iWidth = $aSize[0]
            $iHeight = $aSize[1]
            If $LostPackagemsglist1 = 99 Then
            LoadLostPackagemsglist()
            EndIf
            _WinAPI_MoveWindow($darectionCalListEdit, 13, 98, $iWidth - 28, $iHeight - 250)
            If GUICtrlRead($InformationTab) <> 0 Then
                GUISetState(@SW_HIDE, $LostPackagemsglist)
                EndIf
            If GUICtrlRead($InformationTab) = 2 Then
                ControlShow($Form1, "", $darectionCalListEdit)
            EndIf
    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) <> 0 Then
                GUISetState(@SW_HIDE, $LostPackagemsglist)
                EndIf
            If GUICtrlRead($InformationTab) = 2 Then
                ControlShow($Form1, "", $darectionCalListEdit)
            EndIf
EndFunc

$GUI_EVENT_RESTORE $GUI_EVENT_MAXIMIZE

If GUICtrlRead($InformationTab) <> 0 Then
                GUISetState(@SW_HIDE, $LostPackagemsglist)
EndIf
If GUICtrlRead($InformationTab) = 2 Then
                ControlShow($Form1, "", $darectionCalListEdit)
EndIf

Why $LVS_SORTDESCENDING commented? Then if I un-commenting it list is not showing at all?

Edited by Melba23
  • Moderators
Posted

MarkStaver,

There is an "Edit" button on each post - if you continue to make several additions to a thread in but a few minutes, please learn how to use it. ;)

Here is my version of the MAXIMIZE/RESTORE code - basically you run a simplified version of the SIZE code. :)

Case $GUI_EVENT_MAXIMIZE,$GUI_EVENT_RESTORE ; The same code runs for both
    ; Get the new size
    Local $aSize = WinGetClientSize($Form1)
    $iWidth = $aSize[0]
    $iHeight = $aSize[1]
    ; Has the child been created?
    If IsHWnd($LostPackagemsglist) Then
        ; If so delete...
        GUIDelete($LostPackagemsglist)
        ; ...and recreate the child
        LoadLostPackagemsglist()
    EndIf
    ; Reset the ListView
    _WinAPI_MoveWindow($darectionCalListEdit, 13, 98, $iWidth - 28, $iHeight - 250)
    ; Show if the tab is selected
    If GUICtrlRead($InformationTab) <> 0 Then
        GUISetState(@SW_HIDE, $LostPackagemsglist)
    EndIf
    If GUICtrlRead($InformationTab) = 2 Then
        ControlShow($Form1, "", $darectionCalListEdit)
    EndIf
I did not comment out $LVS_SORTDESCENDING - it was like that in your original script. But if you want to set one specific style, you need to specify the other required styles as well (see the Setting Styles tutorial in the Wiki for more details) - so you need:

$darectionCalListEdit = _GUICtrlListView_Create($Form1, "", 13, 98, 672, 150, BitOr($LVS_REPORT, $LVS_SORTDESCENDING))
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

 

  • Moderators
Posted

MarkStaver,

 

Edit button was not active

Oops, I had forgotten that you needed a few posts before it appeared. Please accept my apologies. :blush:

But promise to use it from now on! ;)

Glad you like the code. :)

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 (edited)

Hello Melba23;

While your Scrollbar code seems to work fairly well, I am having major issues with Minimixing and Restoring windows with scrollbars. If I create a scrollable area, move the SBs to the right and bottom extents, minimize then restore the window, the window is repainted from the 0,0 top left coordinate but the SBs are still at their right and bottom maximums. So, if I scroll back to the 'oringinal page 1" SB location there is just a lot of "whitspace" that has been added to the scroll area. As a simple fix I thought i would just reposition the SBs to the "page 1" location on a restore, but I cannot move the SBs at all on my system programatically (I can move them eith the mouse). Here is a simple example:

#include <GuiConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiScrollBars.au3>
#include "GUIScrollbars_Ex.au3"


$hGui = GUICreate("Scrollbar Test GUI ", 800, 600)

$str = "== 0123456798 ==  == 0123456798 ==  == 0123456798 ==  == 0123456798 ==  == 0123456798 =="
$label = GUICtrlCreateLabel($str, 100, 100, 1200, 50)

$aTSSBRtcCodes = _GUIScrollbars_Generate($hGui, 1400, 900, True)

GUISetState(@SW_SHOW, $hGui)

;sleep(3000)
;_GUIScrollbars_Scroll_Page($hGui,2,2)                              ; does NOT move SB
;if @error <> 0 Then
;   ConsoleWrite(" _GUIScrollbars_Scroll_Page($hGui,2,2) FAILED, error = "& @error)
;EndIf



While 1

    $a_GuiMsgRtnCode = GUIGetMsg(1)

    Switch $a_GuiMsgRtnCode[0]      ; this is the returned message

        Case $GUI_EVENT_CLOSE
            ; if exit is pressed, then close window
            GUIDelete($hGui)
            Exit

        Case $GUI_EVENT_MINIMIZE
            ConsoleWrite("Minimized"& @CRLF)

        Case $GUI_EVENT_RESTORE
            ConsoleWrite("Restore"& @CRLF)
            ;_GUIScrollbars_Scroll_Page($hGui,1,1)              ; does NOT reset SB to page 1
            ;_GUIScrollBars_SetScrollInfoPos($hGui, $SB_HORZ, 1)        ; does NOT  move SB



    EndSwitch

WEnd

There was an example on page 1 of this post that created a simple window  with 2 columns of 100 checkboxes on a scrollable area, I tried that example with the same results: if you scroll right and down, then minimize and restore, the resultant displayed window and the scrollbars become "out of sync".

Then I look at your examples and include files in more detail: I ran your GUIScrollbars_Ex_Example_1.au3 and when I click on the "Scroll" button nothing scrolls. After the 3 second delay (the 3 sleep(1000) lines) the aperture gui is deleted and a new one created, but the "programmatic SB movement" does not occur.

I am using AuoIt:(3.3.12.0) and your latest zip file on 64 bit Win7.

Any help would be greatly appreciated.

Thank you.

 

Edited by nomadicwolf
  • Moderators
Posted

nomadicwolf,

 

While your Scrollbar code seems to work fairly well

Why thank you! :)

 

I am having major issues with Minimixing and Restoring windows with scrollbars

I take it you did not notice the _GUIScrollbars_Minimize/Restore functions? They are designed to resolve the very problem you mention - using them will make the scrollbars behave as you expect:

#include <GUIConstantsEx.au3>
#include "GUIScrollbars_Ex.au3"

$hGui = GUICreate("Scrollbar Test GUI ", 800, 600)

$str = "== 0123456798 ==  == 0123456798 ==  == 0123456798 ==  == 0123456798 ==  == 0123456798 =="
$label = GUICtrlCreateLabel($str, 100, 100, 1200, 50)

$aTSSBRtcCodes = _GUIScrollbars_Generate($hGui, 1400, 900, True)

GUISetState(@SW_SHOW, $hGui)

While 1

    $a_GuiMsgRtnCode = GUIGetMsg(1)

    Switch $a_GuiMsgRtnCode[0]      ; this is the returned message

        Case $GUI_EVENT_CLOSE
            ; if exit is pressed, then close window
            GUIDelete($hGui)
            Exit

        Case $GUI_EVENT_MINIMIZE
            ConsoleWrite("Minimized"& @CRLF)
             _GUIScrollbars_Minimize($hGui) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        Case $GUI_EVENT_RESTORE
            ConsoleWrite("Restore"& @CRLF)
            _GUIScrollbars_Restore($hGui) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    EndSwitch

WEnd
As to the examples not running, I have just downloaded the zip in the first post and tested the contents. The examples run fine for me on x32 Win7 using 3.3.12.0 - or I would not have posted them. Can you please open your copy of GUIScrollBars.au3 (it will be in the standard AutoIt3Include folder) and check that the array declared in the first few lines reads:

Global $__g_aSB_WindowInfo[1][8]
Then look inside GUIScrollBarsEx.au3 (you know where that is) and check that in the first few lines there is an equivalent:

Global $__g_aSB_WindowInfo[1][10]
A change to that variable name forced the last update and I wonder if somehow you have got out of sync. ;)

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)

Good morning Melba23;

First: as you can see that was only my 2nd post in the forums and I guess I was having newbie issues with the web editor yesterday as I got kicked out twice and had to retype everything (and was getting very fustrated), thus I did not give a full account of everything I attempted with this issue.

So, yes, I did see and try your _GUIScrollbars_Minimize/Restore functions (in my main code, not the tiny example I pasted into the post) and they did not do anything either (in my case). With, or without, those functions the window was repainted the same.

Yes; I do have the version of GUIScrollBars.au3 that has the (new) variable: $__g_aSB_WindowInfo[1][8] (I had to do a global replace to change all the old names to the new one in my code:)

I just tried my example that you added the _GUIScrollbars_Minimize/Restore functions to and yes, it worked: the window was repainted to correctly match the location of the scrollbars. So why did it not work in my main code ... (going hunting, back in a while ... I'm posting before I loose this)

(a short time later ...)

UNBELEVIBLE: all I did was uncomment the two (SB_Min/Res) lines I already had tried and now it works.??? I hate it when that happens: Sorry for bothering you :)

(... unless I was using a older version of your SB_Min/Res functions before I commented them out?)

Edited by nomadicwolf
  • Moderators
Posted

nomadicwolf,

No problem - glad you got it working. :)

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)

Hello Melba

While taking a look at the example scripts, I noticed that in GUIScrollbars_Size_Example_2.au3 there is a glitch with resizable windows, where if a scrollable GUI is scrolled partway and then the window is resized vertically, the position of the GUI is reset to the top erroneously.

On script launch, here is how it appears.


dO5bOIC.png


So far so good...

Sknv7dt.png


Now let's try scrolling a bit. Works as intended.

AS86YjF.png


Wait, what's this?

N18cbIZ.png


I don't think that's supposed to happen...

BMHyDdr.png

I don't know if this is an issue in the UDF or the example script; I'm not familiar enough with either to tell off hand. Tested with AutoIT 3.3.12.0 on Windows 8.1, if that makes any difference.

Thank you very much, though, for putting all of this time into developing this. I can already tell this UDF is going to be a life saver later on.

Edited by TheAppleFreak
  • Moderators
Posted

TheAppleFreak,

 

there is a glitch with resizable windows

As I have explained many times (such as >here) the UDF is not designed to work with resizeable GUIs - nor do I intend to add this functionality. I am delighted to hear that you might still find a use for it, but you will have to restrict your usage to fixed GUIs only. ;)

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

TheAppleFreak,

 

As I have explained many times (such as >here) the UDF is not designed to work with resizeable GUIs - nor do I intend to add this functionality. I am delighted to hear that you might still find a use for it, but you will have to restrict your usage to fixed GUIs only. ;)

M23

 

And that's what I get for barely skimming through the thread. My apologies for not paying more attention. 

  • Moderators
Posted

TheAppleFreak,

No 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

 

  • 1 month later...
Posted

Really nice UDF, will make it into the next release of SMF :).

Here's my hack for using scrollbars in resizable GUIs, no warranty for nothing included :lol:...

#include <GUIScrollbars_Ex.au3>
 
Global $i_my_gui_Min_Width = 400, $i_my_gui_Min_Height = 400
 
$h_my_GUI = GUICreate("My GUI", $i_my_gui_Min_Width, $i_my_gui_Min_Height, Default, Default, $WS_SIZEBOX)
GUICtrlCreateButton("Button1", 10, 10)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlCreateButton("Button2", 340, 340)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
 
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
 
GUISetState(@SW_SHOW)
 
While 1
$Msg = GUIGetMsg()
If $Msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
 
 
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
Switch $hWnd
Case $h_my_GUI
AdlibRegister("_Refresh_Scrollbars", 10)
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE
 
Func _Refresh_Scrollbars()
AdlibUnRegister("_Refresh_Scrollbars")
GUIRegisterMsg($WM_SIZE, "")
 
; Reset scrollbar positions to 0
Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
DllStructSetData($tSCROLLINFO, "fMask", $_SCROLLBARCONSTANTS_SIF_POS)
DllStructSetData($tSCROLLINFO, "nMin", 0)
_GUIScrollBars_SetScrollInfo($h_my_GUI, $_SCROLLBARCONSTANTS_SB_VERT, $tSCROLLINFO)
_GUIScrollBars_SetScrollInfo($h_my_GUI, $_SCROLLBARCONSTANTS_SB_HORZ, $tSCROLLINFO)
 
; Hide scrollbars
_GUIScrollBars_ShowScrollBar($h_my_GUI, $SB_BOTH, False)
 
Local $aSize = WinGetPos($h_my_GUI)
 
If $aSize[2] < $i_my_gui_Min_Width And $aSize[3] < $i_my_gui_Min_Height Then
_GUIScrollbars_Generate($h_my_GUI, $i_my_gui_Min_Width, $i_my_gui_Min_Height)
ElseIf $aSize[2] < $i_my_gui_Min_Width Then
_GUIScrollbars_Generate($h_my_GUI, $i_my_gui_Min_Width)
ElseIf $aSize[3] < $i_my_gui_Min_Height Then
_GUIScrollbars_Generate($h_my_GUI, 0, $i_my_gui_Min_Height)
EndIf
 
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
EndFunc   ;==>_Refresh_Scrollbars
  • Moderators
Posted

KaFu,

Thanks for that - it has given me a couple of ideas on how to create a suitable function. Stay tuned! :)

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 (edited)

KaFu (and anyone else reading),

I have incorporated your resizable GUI code into the UDF and added a new function to set the size above which a resizable GUI does not require scrollbars. Please play around with this Beta UDF and associated example and let me know what you think:

<Code removed - see newer Beta below>

I am still looking at how to deal automatically with the increased border size when the GUI is resizable as this is throwing off some of the internal calculations for scrollbar sizing, but as a proof on concept I am pretty pleased. Thanks again for the push to get it working and the basic code (modified versions of which you will find in the 2 new handlers _Scrollbars_WM_SIZE & _Scrollbars_WM_EXITSIZEMOVE. :thumbsup:

M23

Edited by Melba23
Beta code removed

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 (edited)

Hi,

An updated Beta version which copes better with the increased border size by resizing the GUI to cope when required and which tries to maintain the scrolled position if possible:

<snip>

Again, any comments welcomed. :)

M23

Edited by Melba23
Beta code removed

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 (edited)

Hi,

A final Beta version - a new algorithm and a couple of new features (read the _GUIScrollbars_ReSizer header for details):

<snip>

Grateful for any comments. :)

M23

Edited by Melba23
Beta code removed

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] - 22 Nov 14

Added: Ability to use scrollbars with resizeable GUIs. A new function _GUIScrollbars_Resizer will initiate the GUI for resizing - the scrollbars can be set to vanish above a certain GUI size and the GUI can be automatically created at a size such that they do not appear. The function returns an array which can be used to ensure that the GUI cannot be resized above those dimensions.

Despite saying I would not do this, KaFu showed how it might be done and so here is the result. My thanks to him. :thumbsup:

New zip in the first post. :)

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)

Quite busy at the moment, that's why I sadly couldn't test it until now. But I'll definitely use the updated UDF in the next SMF version, thank you for this nice piece of code, Scrollbar calculation is (was) really a pain :)...

Edited by KaFu
  • Moderators
Posted

Hi,

There was a problem with the zip file I uploaded with the new 22 Nov 14 version - there is an error in the UDF code which gives you an "Undeclared Global Variable" error. My apologies - there is a new zip in the first post and this one does work correctly. :>

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