Sign in to follow this  
Followers 0
kiboost

Simple label with scrollbar

5 posts in this topic

#1 ·  Posted (edited)

Hi,

I'm trying to open a window with some text, and can't find how to put a simple label with vertical scrollbar

inside my script, I create another window :

$logGUI = GUICreate("RFR full log", 400, 500, 1000, 60)

$LabelLog = GUICtrlCreateEdit ($file, 10, 10, 380, 300)

GUISetState(@SW_SHOW)

I tried GUICreate("RFR full log", 400, 500, 1000, 60, $WS_VSCROLL) but then the scroll doesn't work at all.

I tried puting $WS_VSCROLL on the label, same thing

When I do a GUICtrlCreateEdit, it has working scrollbars ! (but I don't want text to be edtiable)

Also, I can't find how to close the second window. Hitting the system red cross call the good function but doesn't close the windows

I've tried :

GUISetOnEvent($GUI_EVENT_CLOSE, "LogGUIClose", $logGUI)

Func LogGUIClose()

WinClose("RFR full log")

EndFunc

Doesn't do anything. putting an "exit" in the function indeed exit the script itself (both windows then). So the function work, but how to close this second window ?

Any help would be appreciated

Kib

I've searched on the forum, seems there is some UDF for that but seems rather complex for just a bunch of text with a scroll bar.

Edited by kiboost

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites



kiboost,

If you use the Scrollbars and StringSize UDFs in my sig, you can do it easily: ;)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GUIScrollBars_Ex.au3>
#include <StringSize.au3>

$sText = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
$aText_Info = _StringSize($sText, Default, Default, Default, "", 90)

$hGUI = GUICreate("Test", 500, 500)

GUISetState()

$hScroller = GUICreate("Scroller", 100, 200, 10, 10, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $hGUI)
$hLabel = GUICtrlCreateLabel($aText_Info[0], 0, 0, 183, $aText_Info[3])
GUISetState()

_GUIScrollbars_Generate ($hScroller, 0, $aText_Info[3])


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

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

#3 ·  Posted (edited)

Ok, thanks, got it to work like this :

Func showlog()
    $logfile = "\RFRlog.txt"
    $file = FileRead($logfile, FileGetSize($logfile))
    FileClose($logfile)     $aText_Info = _StringSize($file, Default, Default, Default, "", 380)
    $logGUI = GUICreate("RFR full log", 400, 500, 1000, 60)
    GUISetOnEvent($GUI_EVENT_CLOSE, "LogGUIClose", $logGUI)
    $hLabel = GUICtrlCreateLabel($file, 0, 0, 380, $aText_Info[3])
    GUISetState()

    _GUIScrollbars_Generate ($logGUI, 0, $aText_Info[3])
EndFunc

Func LogGUIClose()
    WinClose($logGUI
EndFunc

But still can't close this popup ! pressing red cross (top right from windows) doesn't do anything !

It works on the main window, not on the second one.

Edited by kiboost

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites

kiboost,

As you created the GUI, try using GUIDelete rather than WinClose - and make sure $logGUI has Global scope. :)

If that does not work, please post the whole code. ;)

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

Melba, let me tell you, you are a bit irritating !!

GUIDelete indeed works perfectly ! I would need a permanent mental connection with you, seems you are autoit god :-))

Many thanks, once again !

Kib


Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

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