Sign in to follow this  
Followers 0
makeinstall

GUI doesnt scroll when new data is added to it

7 posts in this topic

#1 ·  Posted (edited)

I am creating a GUI to inform users of the progress of a script and if the script stops, why it did so (and action they have to take to make it work).

The problem is that as soon as the window is full of data/information, it doesn't scroll and so new info is lost as it is hidden by the GUI.

What I have so far is this. If anyone can see what schoolboy error I've made or if there is a cleaner more elegant way to do this, please do point it out.

All help is appreciated.

; // some code happens here
; // & so we send message to user of its response
GUICtrlSetData($hList, "This is a message to say something happened")

;Loop to keep GUI polling
While 1
 $nMsg = GUIGetMsg()
 Switch $nMsg
 Case $GUI_EVENT_CLOSE
 Exit
 EndSwitch
WEnd



; FUNCTION TO SET UP GUI
Func _CreateGUI()
    $hGUI = GUICreate("Lotus Notes Roaming", 320, 500, -1, -1)
    $hList = GUICtrlCreateList("", 5, 57, 308, 435, BitOR($LBS_NOSEL, $WS_BORDER))
    GUICtrlSetData(-1, "Welcome.....||")
    $Pic1 = GUICtrlCreatePic("images\notesLogo.bmp", 2, 5, 50, 50, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    $Label1 = GUICtrlCreateLabel("ROAMING NOTES PROFILE", 58, 15, 257, 30)
    GUICtrlSetFont(-1, 14, 400, 0, "Arial")
    GUISetState(@SW_SHOW)
EndFunc   ;==>_CreateGUI
Edited by makeinstall

Share this post


Link to post
Share on other sites



This is just so weird. I created an account on this forum just to ask this same question.

I'm trying to do some type of scrolling text progress information and/or troubleshooting data with a GUI and am having issues as well. I ran into the scroll issue. The other issue I saw was that the list type was selectable. It caused an issue whereby if you selected the text in the list while autoit was still running, the next time it was written to it overwrote the selected text. Not what I was after.

I started playing around with a ListView GUI control type, and had different problems. It still didn't scroll. It also added a problem that the items in the list cannot be duplicated. Not what i wanted either to, say, mark the beginning or end of a loop in the window. It might have an answer to the scrolling issue with the possibility of using _GUICtrlListBox_ClickItem to just select the last entered item (instead of scrolling), but I'm fairly new to autoit and the handle aspect seems to be kicking me around.

I'm very interested in what develops.

Share this post


Link to post
Share on other sites

After a bit of experimentation, I found Koda. This is what I came up with. It uses the Edit control instead of a List control. As long as you don't select the text in the edit control box while the script is running (which will cause it to be overwritten), it seems to work. Don't know how to get around that. (Anyone brighter than me with that answer?) The style I was missing before was $ES_AUTOVSCROLL.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Downloads\AutoIT\koda\Forms\Form1.kxf
$Form1 = GUICreate("Status", 245, 265, 475, 282)
$Edit1 = GUICtrlCreateEdit("", 16, 16, 209, 217, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

For $i = 1 to 25
    GuiCtrlSetData($Edit1, "Checking status " & $i & @CRLF, 2)
    sleep(500)
 Next

Share this post


Link to post
Share on other sites

SpaceCadet,

To keep the last entry to the list in view, I would use something like this: :)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ListboxConstants.au3>
#Include <GuiListBox.au3>
#Include <SendMessage.au3>
#include <ScrollBarConstants.au3>


$hGUI = GUICreate("Lotus Notes Roaming", 320, 500, -1, -1)
$hList = GUICtrlCreateList("", 5, 57, 308, 135, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOSEL)) ; Set styles for List
$Label1 = GUICtrlCreateLabel("ROAMING NOTES PROFILE", 58, 15, 257, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Arial")
GUISetState(@SW_SHOW)

GUICtrlSetData($hList, "Welcome.....")

; Start a timer to simulate messages arriving
$iBegin = TimerInit()

;Loop to keep GUI polling
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

    ; Every second
    If TimerDiff($iBegin) > 1000 Then
        GUICtrlSetData($hList, "New message timed at " & @MIN & ":" & @SEC)
        ;Scroll the List control
        GUICtrlSendMsg($hList, $WM_VSCROLL, $SB_LINEDOWN, 0) 
        ; Reset the timer
        $iBegin = TimerInit()
    EndIf

WEnd

Please ask if you have any questions. ;)

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

That's beautiful, man. Thank you both.

Share this post


Link to post
Share on other sites

Melba: So I was just missing the extra descriptor of: $WS_VSCROLL?

[rolls eyes]

Share this post


Link to post
Share on other sites

makeinstall,

So I was just missing the extra descriptor of: $WS_VSCROLL?

No, you also needed this bit to actually scroll down: ;)

;Scroll the List control
GUICtrlSendMsg($hList, $WM_VSCROLL, $SB_LINEDOWN, 0)

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

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