Sign in to follow this  
Followers 0
b3vad

[Resolved]Create GUI elements in a loop

20 posts in this topic

#1 ·  Posted (edited)

I have:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$cl = GUICreate("Cliplog", 500, 730, 513, 10, BitOR($WS_SIZEBOX,$WS_POPUP))
$c1 = GUICtrlCreateRadio("c1", 5, 20, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
GUICtrlSetResizing($c1, $GUI_DOCKRIGHT+$GUI_DOCKWIDTH)
$c2 = GUICtrlCreateRadio("c2", 5, 40, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
GUICtrlSetResizing($c2, $GUI_DOCKRIGHT+$GUI_DOCKWIDTH)
$c3 = GUICtrlCreateRadio("c3", 5, 60, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
GUICtrlSetResizing($c3, $GUI_DOCKRIGHT+$GUI_DOCKWIDTH)
$c4 = GUICtrlCreateRadio("c4", 5, 80, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
GUICtrlSetResizing($c4, $GUI_DOCKRIGHT+$GUI_DOCKWIDTH)
$c5 = GUICtrlCreateRadio("c5", 5, 100, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
GUICtrlSetResizing($c5, $GUI_DOCKRIGHT+$GUI_DOCKWIDTH)
$c6 = GUICtrlCreateRadio("c6", 5, 120, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
GUICtrlSetResizing($c6, $GUI_DOCKRIGHT+$GUI_DOCKWIDTH)
$c7 = GUICtrlCreateRadio("c7", 5, 140, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
GUICtrlSetResizing($c7, $GUI_DOCKRIGHT+$GUI_DOCKWIDTH)
$c8 = GUICtrlCreateRadio("c8", 5, 160, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
GUICtrlSetResizing($c8, $GUI_DOCKRIGHT+$GUI_DOCKWIDTH)
$c9 = GUICtrlCreateRadio("c9", 5, 180, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
GUICtrlSetResizing($c9, $GUI_DOCKRIGHT+$GUI_DOCKWIDTH)
$c10 = GUICtrlCreateRadio("c10", 5, 200, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
GUICtrlSetResizing($c10, $GUI_DOCKRIGHT+$GUI_DOCKWIDTH)
GUISetState(@SW_SHOW)
WinSetOnTop($cl,"",1)
While 1
sleep(100)
  
WEnd

and I wonder if its posible to create them within a loop?

the problem is creating diffrent variables and had no chance with arrays either

any idea will be cool

Edited by b3vad

[center]My language! gets the job done![/center]

Share this post


Link to post
Share on other sites



b3vad,

Welcome to the AutoIt forum. :oops:

You need to use an array like this: :bye:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $aRadios[11]

$hGUI = GUICreate("Cliplog", 500, 730, 513, 10, BitOR($WS_SIZEBOX, $WS_POPUP))

For $i = 1 To UBound($aRadios) - 1
    $aRadios[$i] = GUICtrlCreateRadio("c" & $i, 5, 20 * $i, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKWIDTH)
Next

GUISetState(@SW_SHOW)

WinSetOnTop($hGUI,"",1)

While 1
    Sleep(100)
WEnd

Note you were using the same variable ($c1) for both the GUI and the first radio - not a good idea. :doh:

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

b3vad,

Welcome to the AutoIt forum. ;)

thank you :doh:

You need to use an array like this: ;)

I always had a hard time understanding the arrays :oops:

as far as i got:

Global $aRadios[11] " I have to declare the number of things (I don't know the name of them) in my array "

UBound($aRadios) - 1 "means end of the things and it starts with 0"

Note you were using the same variable ($c1) for both the GUI and the first radio - not a good idea. :cheer:

M23

actually GUI was cl (L) but i got the point an will try to use better name for variables :bye:

[center]My language! gets the job done![/center]

Share this post


Link to post
Share on other sites

b3vad,

I recommend the Arrays tutorial in the Wiki. :bye:

As far as this script goes:

; Declare an array with 11 elements (0,1,2,3,4,5,6,7,8,9,10)
Global $aRadios[11]

$hGUI = GUICreate("Cliplog", 500, 730, 513, 10, BitOR($WS_SIZEBOX, $WS_POPUP))

; We now run our loop starting at 1 and continuing until 10
; because UBound returns the number of elements (11) and we only want the index to go up to 10
; as arrays in Autoit (like many other languages) start at element [0]
For $i = 1 To UBound($aRadios) - 1
    ; Here we fill the $i element of the array with the ControlID of that Radio
    ; and use that index to increase the Y-coordinate (20 * $i)
    $aRadios[$i] = GUICtrlCreateRadio("c" & $i, 5, 20 * $i, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKWIDTH)
Next

Does that make it clearer? :oops:

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

b3vad,

I recommend the Arrays tutorial in the Wiki. :cheer:

will do sir :oops:

Does that make it clearer? ;)

M23

Cristal clear :bye:

----------------------------------

Now it's time for new problem :doh: : Getting clipboard and put in control data

here is the code

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$lc = "empty"
$clip = "empty"
$cnum = 0
$ans = ""
Global $x[21]
$hGUI = GUICreate("Cliplog", 500, 730, -513, 10, BitOR($WS_SIZEBOX, $WS_POPUP))
For $i = 1 To UBound($x) - 1
    $x[$i] = GUICtrlCreateRadio("c" & $i, 5, 20 * $i, 490, 17, BitOR($BS_RIGHT,$BS_RIGHTBUTTON))
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKWIDTH)
Next
GUISetState(@SW_SHOW)
WinSetOnTop($hGUI,"",1)
While 1
   $nMsg = GUIGetMsg()
   $clip = ClipGet()
   if $clip <> $lc Then
   $cnum = $cnum+1
   GUICtrlSetData($x[$cnum], $clip)
   $lc = $clip
   if $cnum >= UBound($x) - 1 Then
   $cnum = 0
   EndIf
   EndIf
  
;~    if $nMsg = $GUI_EVENT_CLOSE Then
;~    Exit
;~    Else
;~    $ans = GUICtrlRead($x[1], 1)
;~    ClipPut($ans)
;~    $lc = $ans
;~    EndIf
WEnd

my code have 2 problems

1- when I removeor move down "$nMsg = GUIGetMsg()" from line 22 it seems "GUICtrlSetData($x[$cnum], $clip)" does an extra move and sets 2 control

2- second part that is in comment right now causes first part stop working

ty for help ;)


[center]My language! gets the job done![/center]

Share this post


Link to post
Share on other sites

I got my second problem

GUI always sends messages (I think a 0 on each loop) and now i need a way to find my messages between them (and an short one because i don't want to creat a long case )

any idea? :oops:


[center]My language! gets the job done![/center]

Share this post


Link to post
Share on other sites

b3vad,

Take a look at this: :bye:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$lc = "empty"
$clip = "empty"
$cnum = 0
$ans = ""
Global $x[21]

$hGUI = GUICreate("Cliplog", 500, 730, 513, 10, BitOR($WS_SIZEBOX, $WS_POPUP))

For $i = 1 To UBound($x) - 1
    $x[$i] = GUICtrlCreateRadio("c" & $i, 5, 20 * $i, 490, 17, BitOR($BS_RIGHT, $BS_RIGHTBUTTON))
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKWIDTH)
Next

GUISetState(@SW_SHOW)

WinSetOnTop($hGUI, "", 1)

While 1

    ; Read the clipboard and store the content if it has changed
    $clip = ClipGet()
    If $clip <> $lc Then
        $cnum = Mod($cnum, UBound($x) - 1) + 1 ; Clever way to get the index to return to 1 when it gets too high <<<<<<<<
        ConsoleWrite($cnum & @CRLF)
        GUICtrlSetData($x[$cnum], $clip)
        $lc = $clip
        ;If $cnum >= UBound($x) - 1 Then  ; And then you do not need these lines <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        ;   $cnum = 1 ; because we are not using element [0]
        ;EndIf
    EndIf

    ; Read the event queue
    $nMsg = GUIGetMsg()

    ; Loop through the radio ControlIDs
    For $i = 1 To UBound($x) - 1
        If $nMsg = $x[$i] Then
            ; Found one - so add the content
            $ans = GUICtrlRead($x[$i], 1)
            ClipPut($ans)
            ; And confirm for testing
            ConsoleWrite("Clipboard set to: " & $ans & @CRLF)
            ; Reset the check variable
            $lc = $ans
            ; No point in looking any further
            ExitLoop
        EndIf
    Next

WEnd

I have commented the important bits - but please ask if you have any questions. :oops:

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

#8 ·  Posted (edited)

Hi Melba & b3vad,I want to send my directories (folders) not files to an array. I looked at your example and changed *.exe for ""

#include <array.au3>
Dim $ComboRobot1CmdSet, $data, $Loc
Dim $Myarray[1]
$Loc = 0
FileChangeDir(@MyDocumentsDir)
ComboRobotCmdSetChange()
While 1
            $a_RobotCmdSetFile = FileFindNextFile($search)
            If @error Then ExitLoop
;~           $data &= @WorkingDir & "" & $a_RobotCmdSetFile & @CR
            _ArrayInsert($Myarray, $Loc, @WorkingDir & "" & $a_RobotCmdSetFile)
   $Loc = $Loc  + 1
        WEnd[/sup]

It works and lists the folders, but it also lists some text files and other strange files without extension (like when you save an au3 file and forget to type the .au3).

How can I list only the folders?

I am working on a project to have the form expand or shrink based on the number of folders and assign each folder to a radio button. I just can't get only the folders list.

Your help is appreciated.

Edited by JailDoctor

Share this post


Link to post
Share on other sites

JailDoctor,

If that code works then I would be very surprised. :D

I would do it like this: ;)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <File.au3>

; Let us use the AutoIt folder
$sPath = StringReplace(@AutoItExe, "AutoIt3.exe", "")

; List the folders in the folder - parameter 2
$aList = _FileListToArray($sPath, "*", 2)

; Create the radio array to match the number of folders
Global $aRadios[$aList[0] + 1] = [$aList[0]]

; Create the GUI
$hGUI = GUICreate("Folder List", 500, 730, 513, 10, BitOR($WS_SIZEBOX, $WS_POPUP))

; Add the radios
For $i = 1 To $aRadios[0]
    $aRadios[$i] = GUICtrlCreateRadio($aList[$i], 5, 20 * $i, 490, 17, BitOR($BS_RIGHT, $BS_RIGHTBUTTON))
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKWIDTH)
Next

GUISetState(@SW_SHOW)

While 1

    ; Read the event queue
    $nMsg = GUIGetMsg()

    ; Loop through the radio ControlIDs
    For $i = 1 To $aRadios[0]
        If $nMsg = $aRadios[$i] Then
            ; Found one!
            MsgBox(0, "Pressed", GUICtrlRead($aRadios[$i], 1))
            ; No point in looking any further
            ExitLoop
        EndIf
    Next

WEnd

Please ask if anything is not clear. :)

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

#10 ·  Posted (edited)

Wow!

You are amazing! You even solved the next problem I would have. How to do a case select to find out what the user selected. Your approach is so much simpler and efficient.

I was thinking of counting how many folders end up in the array, then pass the folders' names to buttons, keep track of the height of the GUI and change the "left" position of the button after a specified "top" value is reached.

You rock!

All this came about because some colleagues want to print patient education material they have in some folders "on the fly."

Instead of calling on the IT department to change the mega-huge electronic medical record, and wait for a couple of months, they came to me.

I suggested to make a "floating semi-transparent" form (topmost) listing the subfolders where the documents reside. Based on the folder they choose, they will get a list of relevant documents. For example if they select diabetes from the GUI, a second GUI listing all the documents in that folder pops up and they just click to print.

It would be much fancier if the GUI only shows as a tab on the side of the screen and appears on mouse hovering. I will look at the help file for some information on this.

Using your technique will save a lot of headaches when they add or delete files or subfolders.

Thank you so much!

You have made my day!

Edited by JailDoctor

Share this post


Link to post
Share on other sites

It would be much fancier if the GUI only shows as a tab on the side of the screen and appears on mouse hovering. I will look at the help file for some information on this.

You should take a look at playlet's for hints on how to do this, or even to integrate this into it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

JailDoctor,

Glad I could help. ;)

You know where we are if you run into difficulties with the next stage. :)

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

I'm back (week ends)

I got the whole code awesome work :D

just the Mode part is some math monster i can't understand the whole thing and don't bother to explain it I spend 4 hrs Google and wiki it but its way above 2+2 that i can understand ;)

ty for help I'll try to find more problems to ask :)


[center]My language! gets the job done![/center]

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

I got the GUI to show the folders, then another GUI to show the files of the selected folder. One click prints the selected file.

I added a radiobutton to the array to create Exit and Cancel choices.

Even played with the size of the windows based on the number for folders or files as well as the length of their names.

Looks and feels nice.

Two Problems:

1) I have some folders with a lot of files, that is why I add the scroll bar if the number of files will not fit within the @DesktopHeight - 100, the scroll bar will not show all the files (or folders) to the end of the list. How do I make the GUI display all the files or folders?

2) How do I delete the GUI when the user presses the X? I tried

If $nMsg = $GUI_EVENT_CLOSE then
Exit
EndIf

but it did not work.

Here is the entire code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIButton.au3>
#include <File.au3>
#include <array.au3>
;for scroll bars
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
HotKeySet("{ESC}", "MyExit")
dim $whichfolder, $scrollmarker, $scrollmarker2
Global $NewWidth[1], $NewGUIWidth[1]
; Set the working folder
;~ $sPath = @MyDocumentsDir
$sPath = FileSelectFolder("Choose a folder.", "") & ""
MyFolderChoice()
Func MyFolderChoice()
; List the folders in the folder - parameter 2
$aList = _FileListToArray($sPath, "*", 2)
_ArrayAdd($aList, "Exit")
$aList[0] = $aList[0] + 1
;Set GUI height based on number of folders
$GuiHeight = $aList[0]  *22
If $GuiHeight > @DesktopHeight Then
$scrollmarker = True ; to show or not the sroll bars
$GuiHeight = @DesktopHeight - 100
EndIf
;Set the GUI width based on the longest folder name
For $a = 1 to $aList[0]
$FolderNameLength =  $aList[$a]
$FolderNameLength2 =StringLen($FolderNameLength)
_ArrayAdd($NewWidth, $FolderNameLength2)
Next
;~ $NewWidth2 = _ArrayMax($NewWidth,0,1)
$NewWidthSize = _ArrayMax($NewWidth)
$GuiWidth = $NewWidthSize * 8
If $GuiWidth < 200 Then ;Make sure it isn't too thin
$GuiWidth = 200
EndIf
; Create the radio array to match the number of folders
Global $aRadios[$aList[0] + 1] = [$aList[0]]
; Create the GUI
$hGUI = GUICreate("Folder List", $GuiWidth, $GuiHeight, 500, 10, BitOR($WS_SIZEBOX, $WS_POPUP))

; Add the radios
For $i = 1 To $aRadios[0]
    $aRadios[$i] = GUICtrlCreateRadio($aList[$i], 20, 20 * $i, 490, 17)
Next

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")
GUISetState()
If $scrollmarker = True Then ;We need the scroll bars
_GUIScrollBars_Init($hGUI)
EndIf
While 1
    ; Read the event queue
    $nMsg = GUIGetMsg()
    ; Loop through the radio ControlIDs
    For $i = 1 To $aRadios[0]
        If $nMsg = $aRadios[$i] Then
     If GUICtrlRead($aRadios[$i], 1) = "Exit" Then
      Exit
     EndIf
            ; Found one!
;~           MsgBox(0, "Pressed", GUICtrlRead($aRadios[$i], 1))
            ; No point in looking any further
   $whichfolder = $sPath & "" & GUICtrlRead($aRadios[$i], 1) ; Set the path to show files
   _GUICtrlButton_SetCheck($nMsg,  $BST_UNCHECKED)
   GUIDelete();Delete the gui
   MyFileChoice(); Call the file selection function
            ExitLoop
        EndIf
    Next
WEnd
EndFunc
Func MyFileChoice()
$aList2 = _FileListToArray($whichfolder, "*", 1);file names to array
  If $aList2 = 0 Then ;empty folder check
  MsgBox(0,"Error","There are no files to print in " & $whichfolder)
  MyFolderChoice()
EndIf
_ArrayAdd($aList2, "Cancel") ;add an extra button for cancelling file selection
$aList2[0] = $aList2[0] + 1 ;Fix the number of elements to include the cancel button in the gui
; Create the radio array to match the number of folders
Global $aRadios2[$aList2[0] + 1] = [$aList2[0]]

;Set GUI height based on number of folders
$GuiHeight2 = $aList2[0]  * 22
If $GuiHeight2 > @DesktopHeight Then
$scrollmarker2 = True ; to show or not the sroll bars
$GuiHeight2 = @DesktopHeight - 100
ElseIf $GuiHeight2 < 150 Then
$GuiHeight2 = 150
EndIf
;Set the GUI width based on the longest folder name
For $b = 1 to $aList2[0]
$FileNameLength =  $aList2[$b]
$FileNameLength2 =StringLen($FileNameLength)
_ArrayAdd($NewGUIWidth, $FileNameLength2)
Next
;~ $NewWidth3 = _ArrayMax($NewGUIWidth,0,1)
$NewWidthSize2 = _ArrayMax($NewGUIWidth)
$GuiWidth2 = $NewWidthSize2 * 8
If $GuiWidth2 < 200 Then
$GuiWidth2 = 200
EndIf
; Create the GUI
$hGUI2 = GUICreate("Files List", $GuiWidth2, $GuiHeight2 , 160, 10, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
; Add the radios
For $i = 1 To $aRadios2[0]
$aRadios2[$i] = GUICtrlCreateRadio($aList2[$i],20, 20 * $i, 490, 17)
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKWIDTH)

Next
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
GUISetState()
If $scrollmarker2 = True Then ;We need the scroll bars
_GUIScrollBars_Init($hGUI2)
EndIf
While 1
; Read the event queue
    $nMsg2 = GUIGetMsg()
    ; Loop through the radio ControlIDs
    For $i = 1 To $aRadios2[0]
        If $nMsg2 = $aRadios2[$i] Then
     If GUICtrlRead($aRadios2[$i], 1) = "Cancel" Then
      GUIDelete()
      MyFolderChoice() ;build the other window again
      ExitLoop
     EndIf
            ; Found one!
            MsgBox(0, "Pressed", GUICtrlRead($aRadios2[$i], 1))
;~  _FilePrint(GUICtrlRead($aRadios2[$i], 1));Print the selected file.
   GUIDelete()
   MyFolderChoice() ;build the other window again
            ExitLoop
        EndIf
    Next
WEnd
EndFunc
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam
Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
For $x = 0 To UBound($aSB_WindowInfo) - 1
  If $aSB_WindowInfo[$x][0] = $hWnd Then
   $index = $x
   $xClientMax = $aSB_WindowInfo[$index][1]
   $xChar = $aSB_WindowInfo[$index][2]
   $yChar = $aSB_WindowInfo[$index][3]
   $ivMax = $aSB_WindowInfo[$index][7]
   ExitLoop
  EndIf
Next
If $index = -1 Then Return 0
Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
; Retrieve the dimensions of the client area.
$xClient = BitAND($lParam, 0x0000FFFF)
$yClient = BitShift($lParam, 16)
$aSB_WindowInfo[$index][4] = $xClient
$aSB_WindowInfo[$index][5] = $yClient
; Set the vertical scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
;~  DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
; Set the horizontal scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE
Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $xChar, $xPos
Local $Min, $Max, $Page, $Pos, $TrackPos
For $x = 0 To UBound($aSB_WindowInfo) - 1
  If $aSB_WindowInfo[$x][0] = $hWnd Then
   $index = $x
   $xChar = $aSB_WindowInfo[$index][2]
   ExitLoop
  EndIf
Next
If $index = -1 Then Return 0
;~  ; Get all the horizontal scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$xPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $xPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
#forceref $Min, $Max
Switch $nScrollCode
  Case $SB_LINELEFT ; user clicked left arrow
   DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
  Case $SB_LINERIGHT ; user clicked right arrow
   DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
  Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
  Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
  Case $SB_THUMBTRACK ; user dragged the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch
;~  // Set the position and then retrieve it.  Due to adjustments
;~  //   by Windows it may not be the same as the value set.
DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_HSCROLL
Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $yChar, $yPos
Local $Min, $Max, $Page, $Pos, $TrackPos
For $x = 0 To UBound($aSB_WindowInfo) - 1
  If $aSB_WindowInfo[$x][0] = $hWnd Then
   $index = $x
   $yChar = $aSB_WindowInfo[$index][3]
   ExitLoop
  EndIf
Next
If $index = -1 Then Return 0

; Get all the vertial scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$yPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $yPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
Switch $nScrollCode
  Case $SB_TOP ; user clicked the HOME keyboard key
   DllStructSetData($tSCROLLINFO, "nPos", $Min)
  Case $SB_BOTTOM ; user clicked the END keyboard key
   DllStructSetData($tSCROLLINFO, "nPos", $Max)
  Case $SB_LINEUP ; user clicked the top arrow
   DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
  Case $SB_LINEDOWN ; user clicked the bottom arrow
   DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
  Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
  Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
  Case $SB_THUMBTRACK ; user dragged the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch
;~  // Set the position and then retrieve it.  Due to adjustments
;~  //   by Windows it may not be the same as the value set.
DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $yPos) Then
  _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
  $yPos = $Pos
EndIf
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_VSCROLL
Func MyExit()
Exit
EndFunc   ;==>MyExit

Thanks for your help

Edited by JailDoctor

Share this post


Link to post
Share on other sites

JailDoctor,

- 1. Use my GUIScrollbars_Size UDF (look in my sig for the link) which will let you set the scroll bars to the correct size for the number of radios.

- 2. The only GUI with a closure [X] is $hGUI2, so you need to add the $GUI_EVENT_CLOSE to that loop.

Here is the relevant bit of your script: :)

; Create the GUI
$hGUI2 = GUICreate("Files List", $GuiWidth2, $GuiHeight2, 160, 10, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
; Add the radios
For $i = 1 To $aRadios2[0]
    $aRadios2[$i] = GUICtrlCreateRadio($aList2[$i], 20, 20 * $i, 490, 17)
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKWIDTH)
Next
;GUIRegisterMsg($WM_SIZE, "WM_SIZE")  ; You have already registered these once
;GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL") ; so no need to do it again
GUISetState()
If $scrollmarker2 = True Then ;We need the scroll bars
    _GUIScrollBars_Init($hGUI2)
    $aRet = _GUIScrollbars_Size(0, $aRadios2[0] * 20, $GuiWidth2, $GuiHeight2) ; <<<<<<<<<<<<<<<<<<
    _GUIScrollBars_SetScrollInfoPage($hGUI2, $SB_VERT, $aRet[2]) ; <<<<<<<<<<<<<<<<<<
    _GUIScrollBars_SetScrollInfoMax($hGUI2, $SB_VERT, $aRet[3]) ; <<<<<<<<<<<<<<<<<<
EndIf
While 1
    ; Read the event queue
    $nMsg2 = GUIGetMsg()
    If $nMsg2 = $GUI_EVENT_CLOSE Then Exit ; <<<<<<<<<<<<<<<<<<
    ; Loop through the radio ControlIDs
    For $i = 1 To $aRadios2[0]

You will need to add the GUIScrollbars_Size file as an include of course. :D

All clear? ;)

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

#16 ·  Posted (edited)

Melba23,

I got this error:

>Running AU3Check (1.54.19.0) from:C:Program FilesAutoIt3

C:Program FilesAutoIt3IncludeGUIScrollbars_Size.au3(239,65) : ERROR: _GUIScrollbars_Restore() already defined.

Func _GUIScrollbars_Restore($hWnd, $fVert = True, $fHorz = True)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

I commented out this function in your GUIScrollbars_Size.au3 file but it didn't help.

Current Problem (commenting out the Func _GUIScrollbars_Restore($hWnd, $fVert = True, $fHorz = True) from the C:\Program Files\AutoIt3\Include\GUIScrollbars_Size.au3 file:

  • If the folder contains less then about 56 sub folders, there is no problem displaying all folders and see them scrolling down in the GUI..
  • When a folder contains a gazillion subfolders (like my users will probably have), the scroll bar does not show all of them. It seems to stop listing folders after the 56th folder.
Here is the code. I wrote a little routine to show the window only when the user moves the mouse off the right edge of the desktop.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..My H drivelogo.ico
#AutoIt3Wrapper_outfile=H:My DocumentsPopUpTest.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIButton.au3>
#include <File.au3>
#include <array.au3>
;for scroll bars
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include "GUIScrollbars_Ex.au3"
#include "GUIScrollbars_Size.au3"
;for "peekaboo effect" right screen show function. Move mouse to the right side of the screen to show the window.
#include <GDIPlus.au3>
#include <Misc.au3>
HotKeySet("{ESC}", "MyExit")
dim $whichfolder, $scrollmarker, $scrollmarker2
Global $NewWidth[1], $NewGUIWidth[1]
; Set the working folder
;~ $sPath = @MyDocumentsDir
$sPath = FileSelectFolder("Choose a folder.", "") & ""
ToolTip("Move your mouse to the rigth margin of the screen to select pamphlets",300,300,"Patient Education Program",2,4)
Sleep(2000)
Tooltip("")
HideTheGUI()

Func HideTheGUI()
While 1
$mpos = MouseGetPos()
    Select
        Case $mpos[0] > @DesktopWidth-50
MyFolderChoice()
EndSelect
WEnd
EndFunc

Func MyFolderChoice()
; List the folders in the folder - parameter 2
$aList = _FileListToArray($sPath, "*", 2)
_ArrayAdd($aList, "Exit")
$aList[0] = $aList[0] + 1
;Set GUI height based on number of folders
$GuiHeight = $aList[0]  *22
If $GuiHeight > @DesktopHeight Then
$scrollmarker = True ; to show or not the sroll bars
$GuiHeight = @DesktopHeight - 100
EndIf
;Set the GUI width based on the longest folder name
For $a = 1 to $aList[0]
$FolderNameLength =  $aList[$a]
$FolderNameLength2 =StringLen($FolderNameLength)
_ArrayAdd($NewWidth, $FolderNameLength2)
Next
;~ $NewWidth2 = _ArrayMax($NewWidth,0,1)
$NewWidthSize = _ArrayMax($NewWidth)
$GuiWidth = $NewWidthSize * 8
If $GuiWidth < 200 Then ;Make sure it isn't too thin
$GuiWidth = 200
EndIf
; Create the radio array to match the number of folders
Global $aRadios[$aList[0] + 1] = [$aList[0]]
; Create the GUI
$hGUI = GUICreate("Folder List", $GuiWidth, $GuiHeight, 500, 10, BitOR($WS_SIZEBOX, $WS_POPUP))

; Add the radios
For $i = 1 To $aRadios[0]
    $aRadios[$i] = GUICtrlCreateRadio($aList[$i], 20, 20 * $i, 490, 17)
Next

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")
GUISetState()
If $scrollmarker = True Then ;We need the scroll bars
_GUIScrollBars_Init($hGUI)
EndIf
While 1
    ; Read the event queue
    $nMsg = GUIGetMsg()
    ; Loop through the radio ControlIDs
    For $i = 1 To $aRadios[0]
        If $nMsg = $aRadios[$i] Then
     If GUICtrlRead($aRadios[$i], 1) = "Exit" Then
      Exit
     EndIf
            ; Found one!
;~           MsgBox(0, "Pressed", GUICtrlRead($aRadios[$i], 1))
            ; No point in looking any further
   $whichfolder = $sPath & "" & GUICtrlRead($aRadios[$i], 1) ; Set the path to show files
   _GUICtrlButton_SetCheck($nMsg,  $BST_UNCHECKED)
   GUIDelete();Delete the gui
   MyFileChoice(); Call the file selection function
            ExitLoop
        EndIf
    Next
WEnd
EndFunc
Func MyFileChoice()
$aList2 = _FileListToArray($whichfolder, "*", 1);file names to array
  If $aList2 = 0 Then ;empty folder check
  MsgBox(0,"Error","There are no files to print in " & $whichfolder)
  MyFolderChoice()
EndIf
_ArrayAdd($aList2, "Cancel") ;add an extra button for cancelling file selection
$aList2[0] = $aList2[0] + 1 ;Fix the number of elements to include the cancel button in the gui
; Create the radio array to match the number of folders
Global $aRadios2[$aList2[0] + 1] = [$aList2[0]]

;Set GUI height based on number of folders
$GuiHeight2 = $aList2[0]  * 22
If $GuiHeight2 > @DesktopHeight Then
$scrollmarker2 = True ; to show or not the sroll bars
$GuiHeight2 = @DesktopHeight - 100
ElseIf $GuiHeight2 < 150 Then
$GuiHeight2 = 150
EndIf
;Set the GUI width based on the longest folder name
For $b = 1 to $aList2[0]
$FileNameLength =  $aList2[$b]
$FileNameLength2 =StringLen($FileNameLength)
_ArrayAdd($NewGUIWidth, $FileNameLength2)
Next
$NewWidthSize2 = _ArrayMax($NewGUIWidth)
$GuiWidth2 = $NewWidthSize2 * 8
If $GuiWidth2 < 200 Then ;GUI is too thin
$GuiWidth2 = 200
EndIf
; Create the GUI
$hGUI2 = GUICreate("Files List", $GuiWidth2, $GuiHeight2 , 160, 10, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
; Add the radios
For $i = 1 To $aRadios2[0]
$aRadios2[$i] = GUICtrlCreateRadio($aList2[$i],20, 20 * $i, 490, 17)
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKWIDTH)

Next

GUISetState()
If $scrollmarker2 = True Then ;We need the scroll bars
    _GUIScrollBars_Init($hGUI2)
    $aRet = _GUIScrollbars_Size(0, $aRadios2[0] * 20, $GuiWidth2, $GuiHeight2) ; <<<<<<<<<<<<<<<<<<
    _GUIScrollBars_SetScrollInfoPage($hGUI2, $SB_VERT, $aRet[2]) ; <<<<<<<<<<<<<<<<<<
    _GUIScrollBars_SetScrollInfoMax($hGUI2, $SB_VERT, $aRet[3]) ; <<<<<<<<<<<<<<<<<<
EndIf

;~ If $scrollmarker2 = True Then ;We need the scroll bars
;~  _GUIScrollBars_Init($hGUI2)
;~   $aRet = _GUIScrollbars_Size(0, $aRadios2[0] * 20, $GuiWidth2, $GuiHeight2) ; <<<<<<<<<<<<<<<<<<
;~   _GUIScrollBars_SetScrollInfoPage($hGUI2, $SB_VERT, $aRet[2]) ; <<<<<<<<<<<<<<<<<<
;~   _GUIScrollBars_SetScrollInfoMax($hGUI2, $SB_VERT, $aRet[3]) ; <<<<<<<<<<<<<<<<<<
;~ EndIf
While 1
; Read the event queue
    $nMsg2 = GUIGetMsg()
  If $nMsg2 = $GUI_EVENT_CLOSE Then
      GUIDelete()
      HideTheGUI() ;Hide the window
      ExitLoop
EndIf
    ; Loop through the radio ControlIDs
    For $i = 1 To $aRadios2[0]
        If $nMsg2 = $aRadios2[$i] Then
     If GUICtrlRead($aRadios2[$i], 1) = "Cancel" Then
      GUIDelete()
      HideTheGUI() ;Hide the window
      ExitLoop
     EndIf
            ; Found one!
;~           MsgBox(0, "Pressed", GUICtrlRead($aRadios2[$i], 1))
   _FilePrint(GUICtrlRead($aRadios2[$i], 1));Print the selected file.
   GUIDelete()
;~  MyFolderChoice() ;build the other window again
   HideTheGUI()
            ExitLoop
        EndIf
    Next
WEnd
EndFunc

Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam
Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
For $x = 0 To UBound($aSB_WindowInfo) - 1
  If $aSB_WindowInfo[$x][0] = $hWnd Then
   $index = $x
   $xClientMax = $aSB_WindowInfo[$index][1]
   $xChar = $aSB_WindowInfo[$index][2]
   $yChar = $aSB_WindowInfo[$index][3]
   $ivMax = $aSB_WindowInfo[$index][7]
   ExitLoop
  EndIf
Next
If $index = -1 Then Return 0
Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
; Retrieve the dimensions of the client area.
$xClient = BitAND($lParam, 0x0000FFFF)
$yClient = BitShift($lParam, 16)
$aSB_WindowInfo[$index][4] = $xClient
$aSB_WindowInfo[$index][5] = $yClient
; Set the vertical scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
;~  DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
; Set the horizontal scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE
Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $xChar, $xPos
Local $Min, $Max, $Page, $Pos, $TrackPos
For $x = 0 To UBound($aSB_WindowInfo) - 1
  If $aSB_WindowInfo[$x][0] = $hWnd Then
   $index = $x
   $xChar = $aSB_WindowInfo[$index][2]
   ExitLoop
  EndIf
Next
If $index = -1 Then Return 0
;~  ; Get all the horizontal scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$xPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $xPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
#forceref $Min, $Max
Switch $nScrollCode
  Case $SB_LINELEFT ; user clicked left arrow
   DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
  Case $SB_LINERIGHT ; user clicked right arrow
   DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
  Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
  Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
  Case $SB_THUMBTRACK ; user dragged the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch
;~  // Set the position and then retrieve it.  Due to adjustments
;~  //   by Windows it may not be the same as the value set.
DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_HSCROLL
Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $yChar, $yPos
Local $Min, $Max, $Page, $Pos, $TrackPos
For $x = 0 To UBound($aSB_WindowInfo) - 1
  If $aSB_WindowInfo[$x][0] = $hWnd Then
   $index = $x
   $yChar = $aSB_WindowInfo[$index][3]
   ExitLoop
  EndIf
Next
If $index = -1 Then Return 0

; Get all the vertial scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$yPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $yPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
Switch $nScrollCode
  Case $SB_TOP ; user clicked the HOME keyboard key
   DllStructSetData($tSCROLLINFO, "nPos", $Min)
  Case $SB_BOTTOM ; user clicked the END keyboard key
   DllStructSetData($tSCROLLINFO, "nPos", $Max)
  Case $SB_LINEUP ; user clicked the top arrow
   DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
  Case $SB_LINEDOWN ; user clicked the bottom arrow
   DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
  Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
  Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
  Case $SB_THUMBTRACK ; user dragged the scroll box
   DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch
;~  // Set the position and then retrieve it.  Due to adjustments
;~  //   by Windows it may not be the same as the value set.
DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $yPos) Then
  _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
  $yPos = $Pos
EndIf
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_VSCROLL
Func MyExit()
Exit
EndFunc   ;==>MyExit

Comment:

The function Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) makes a solid scroll bar occupying the entire window, so I edited it like this:

; Set the vertical scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
;~  DllStructSetData($tSCROLLINFO, "nMax", $ivMax) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

Very confused now ;)

Edited by JailDoctor

Share this post


Link to post
Share on other sites

JailDoctor,

That sounds as if you included both of the UDFs - you only need the one: :D

This works perfectly for me: ;)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIButton.au3>
#include <File.au3>
#include <array.au3>
;for scroll bars
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <GUIScrollbars_Size.au3> ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#include <ScrollBarConstants.au3>
HotKeySet("{ESC}", "MyExit")
Dim $whichfolder, $scrollmarker, $scrollmarker2
Global $NewWidth[1], $NewGUIWidth[1]
; Set the working folder
;~ $sPath = @MyDocumentsDir
$sPath = FileSelectFolder("Choose a folder.", "") & ""
MyFolderChoice()
Func MyFolderChoice()
    ; List the folders in the folder - parameter 2
    $aList = _FileListToArray($sPath, "*", 2)
    _ArrayAdd($aList, "Exit")
    $aList[0] = $aList[0] + 1
    ;Set GUI height based on number of folders
    $GuiHeight = $aList[0] * 22
    If $GuiHeight > @DesktopHeight Then
        $scrollmarker = True ; to show or not the sroll bars
        $GuiHeight = @DesktopHeight - 100
    EndIf
    ;Set the GUI width based on the longest folder name
    For $a = 1 To $aList[0]
        $FolderNameLength = $aList[$a]
        $FolderNameLength2 = StringLen($FolderNameLength)
        _ArrayAdd($NewWidth, $FolderNameLength2)
    Next
;~ $NewWidth2 = _ArrayMax($NewWidth,0,1)
    $NewWidthSize = _ArrayMax($NewWidth)
    $GuiWidth = $NewWidthSize * 8
    If $GuiWidth < 200 Then ;Make sure it isn't too thin
        $GuiWidth = 200
    EndIf
    ; Create the radio array to match the number of folders
    Global $aRadios[$aList[0] + 1] = [$aList[0]]
    ; Create the GUI
    $hGUI = GUICreate("Folder List", $GuiWidth, $GuiHeight, 500, 10, BitOR($WS_SIZEBOX, $WS_POPUP))

    ; Add the radios
    For $i = 1 To $aRadios[0]
        $aRadios[$i] = GUICtrlCreateRadio($aList[$i], 20, 20 * $i, 490, 17)
    Next

    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
    GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")
    GUISetState()
    If $scrollmarker = True Then ;We need the scroll bars
        _GUIScrollBars_Init($hGUI)
    EndIf
    While 1
        ; Read the event queue
        $nMsg = GUIGetMsg()
        ; Loop through the radio ControlIDs
        For $i = 1 To $aRadios[0]
            If $nMsg = $aRadios[$i] Then
                If GUICtrlRead($aRadios[$i], 1) = "Exit" Then
                    Exit
                EndIf
                ; Found one!
;~           MsgBox(0, "Pressed", GUICtrlRead($aRadios[$i], 1))
                ; No point in looking any further
                $whichfolder = $sPath & "" & GUICtrlRead($aRadios[$i], 1) ; Set the path to show files
                _GUICtrlButton_SetCheck($nMsg, $BST_UNCHECKED)
                GUIDelete();Delete the gui
                MyFileChoice(); Call the file selection function
                ExitLoop
            EndIf
        Next
    WEnd
EndFunc   ;==>MyFolderChoice
Func MyFileChoice()
    $aList2 = _FileListToArray($whichfolder, "*", 1);file names to array
    If $aList2 = 0 Then ;empty folder check
        MsgBox(0, "Error", "There are no files to print in " & $whichfolder)
        MyFolderChoice()
    EndIf
    _ArrayAdd($aList2, "Cancel") ;add an extra button for cancelling file selection
    $aList2[0] = $aList2[0] + 1 ;Fix the number of elements to include the cancel button in the gui
    ; Create the radio array to match the number of folders
    Global $aRadios2[$aList2[0] + 1] = [$aList2[0]]

    ;Set GUI height based on number of folders
    $GuiHeight2 = $aList2[0] * 22
    If $GuiHeight2 > @DesktopHeight Then
        $scrollmarker2 = True ; to show or not the sroll bars
        $GuiHeight2 = @DesktopHeight - 100
    ElseIf $GuiHeight2 < 150 Then
        $GuiHeight2 = 150
    EndIf
    ;Set the GUI width based on the longest folder name
    For $b = 1 To $aList2[0]
        $FileNameLength = $aList2[$b]
        $FileNameLength2 = StringLen($FileNameLength)
        _ArrayAdd($NewGUIWidth, $FileNameLength2)
    Next
;~ $NewWidth3 = _ArrayMax($NewGUIWidth,0,1)
    $NewWidthSize2 = _ArrayMax($NewGUIWidth)
    $GuiWidth2 = $NewWidthSize2 * 8
    If $GuiWidth2 < 200 Then
        $GuiWidth2 = 200
    EndIf
    ; Create the GUI
    $hGUI2 = GUICreate("Files List", $GuiWidth2, $GuiHeight2, 160, 10, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
    ; Add the radios
    For $i = 1 To $aRadios2[0]
        $aRadios2[$i] = GUICtrlCreateRadio($aList2[$i], 20, 20 * $i, 490, 17)
        GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKWIDTH)
    Next
    ;GUIRegisterMsg($WM_SIZE, "WM_SIZE")  ; You have already registered these once
    ;GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL") ; so no need to do it again
    GUISetState()
    If $scrollmarker2 = True Then ;We need the scroll bars
        _GUIScrollBars_Init($hGUI2)
        $aRet = _GUIScrollbars_Size(0, $aRadios2[0] * 20, $GuiWidth2, $GuiHeight2) ; <<<<<<<<<<<<<<<<<<
        _GUIScrollBars_SetScrollInfoPage($hGUI2, $SB_VERT, $aRet[2]) ; <<<<<<<<<<<<<<<<<<
        _GUIScrollBars_SetScrollInfoMax($hGUI2, $SB_VERT, $aRet[3]) ; <<<<<<<<<<<<<<<<<<
    EndIf
    While 1
        ; Read the event queue
        $nMsg2 = GUIGetMsg()
        If $nMsg2 = $GUI_EVENT_CLOSE Then Exit ; <<<<<<<<<<<<<<<<<<
        ; Loop through the radio ControlIDs
        For $i = 1 To $aRadios2[0]
            If $nMsg2 = $aRadios2[$i] Then
                If GUICtrlRead($aRadios2[$i], 1) = "Cancel" Then
                    GUIDelete()
                    MyFolderChoice() ;build the other window again
                    ExitLoop
                EndIf
                ; Found one!
                MsgBox(0, "Pressed", GUICtrlRead($aRadios2[$i], 1))
;~  _FilePrint(GUICtrlRead($aRadios2[$i], 1));Print the selected file.
                GUIDelete()
                MyFolderChoice() ;build the other window again
                ExitLoop
            EndIf
        Next
    WEnd
EndFunc   ;==>MyFileChoice
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xClientMax = $aSB_WindowInfo[$index][1]
            $xChar = $aSB_WindowInfo[$index][2]
            $yChar = $aSB_WindowInfo[$index][3]
            $ivMax = $aSB_WindowInfo[$index][7]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0
    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
    ; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient
    ; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
;~  DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    ; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE
Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $xChar, $xPos
    Local $Min, $Max, $Page, $Pos, $TrackPos
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xChar = $aSB_WindowInfo[$index][2]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0
;~  ; Get all the horizontal scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $xPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $xPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    #forceref $Min, $Max
    Switch $nScrollCode
        Case $SB_LINELEFT ; user clicked left arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
        Case $SB_LINERIGHT ; user clicked right arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
        Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
        Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
        Case $SB_THUMBTRACK ; user dragged the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch
;~  // Set the position and then retrieve it.  Due to adjustments
;~  //   by Windows it may not be the same as the value set.
    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_HSCROLL
Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $yChar = $aSB_WindowInfo[$index][3]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0

    ; Get all the vertial scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    Switch $nScrollCode
        Case $SB_TOP ; user clicked the HOME keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Min)
        Case $SB_BOTTOM ; user clicked the END keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Max)
        Case $SB_LINEUP ; user clicked the top arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
        Case $SB_LINEDOWN ; user clicked the bottom arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
        Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
        Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
        Case $SB_THUMBTRACK ; user dragged the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch
;~  // Set the position and then retrieve it.  Due to adjustments
;~  //   by Windows it may not be the same as the value set.
    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_VSCROLL
Func MyExit()
    Exit
EndFunc   ;==>MyExit

How about you? :)

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

#18 ·  Posted (edited)

It works!

When I select a folder pointing to a shared drive with 109 sub folders there is a problem displaying all the sub folders. The scroll bar only goes down to folder 56; but I can live with it unless you have any ideas. ;)

Edited by JailDoctor

Share this post


Link to post
Share on other sites

JailDoctor,

Of course I have ideas! :D

You need to set the scrollbars size for the first GUI in the same way as as you do for the second: ;)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")
GUISetState()
If $scrollmarker = True Then ;We need the scroll bars
    _GUIScrollBars_Init($hGUI)
    $aRet = _GUIScrollbars_Size(0, $aRadios[0] * 20, $GuiWidth, $GuiHeight) ; <<<<<<<<<<<<<<<<<<
    _GUIScrollBars_SetScrollInfoPage($hGUI, $SB_VERT, $aRet[2]) ; <<<<<<<<<<<<<<<<<<
    _GUIScrollBars_SetScrollInfoMax($hGUI, $SB_VERT, $aRet[3]) ; <<<<<<<<<<<<<<<<<<
EndIf
While 1
    ; Read the event queue
    $nMsg = GUIGetMsg()

All fixed? :)

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

Outstanding!!!!

You are the best!!!

It makes perfect sense now. Why not do what worked in the other gui...

You make it look so easy.

Thank you so much!

;)

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