Jump to content

Scrollable Label


Recommended Posts

hmm,.. dont know if this prob has been ever solved - but i looked and searched a long time in this forum - but dont found anything,..

OK,..my problem:

i have a .txt file with a large text. i want to scroll in this label - but it doesnt work - why?

CODE

$text=FileRead("startseite.txt")

GUICtrlCreateLabel ($text, 230, 135, 530,440,$ES_AUTOVSCROLL+$WS_VSCROLL)

hmmm,...

i solved it with an inputbox:

CODE

$text=FileRead("startseite.txt")

GUICtrlCreateEdit ($text, 230, 135, 510,440,BitOR($ES_READONLY, $WS_VSCROLL, $ES_MULTILINE))

can i deactivate the Cursor?

Link to comment
Share on other sites

There's no getting rid of the cursor, and I don't think labels can ever scroll in the first place, though you can put scrollbars on them visually. Even Windows Update on 2000 and XP uses a read-only edit box for the installation log, and the cursor is indeed visible. Or next time you use one of those "wizard" installers, check the license agreement page and I'll bet you can see a cursor if you click in the text area (you might also see it in the list of files that are being installed). It's really not a big deal, and it also allows you to select and copy the text.

Link to comment
Share on other sites

I was talking about the text cursor. You know, the little blinking vertical line that marks your place in an edit box. I think it would be quite odd to remove the mouse cursor from Aekschnuschi's edit box (especially since it would make manipulating the scrollbars rather difficult).

Edited by Sokko
Link to comment
Share on other sites

There's no getting rid of the cursor...

#include <GUIConstants.au3>

$hidden = False

$gui = GUICreate('My Hide Caret', 200, 200)
$edit = GUICtrlCreateEdit('Here is my edit box with no caret!', 50, 50, 100, 100, $ES_READONLY)

GUISetState()

While 1
    If WinActive('My Hide Caret') And Not $hidden Then
        DllCall('user32.dll', 'int', 'DestroyCaret')
        $hidden = True  ;  this so it's not called over and over
    EndIf
    If Not WinActive('My Hide Caret') Then $hidden = False
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd
Edited by xcal
Link to comment
Share on other sites

DestroyCaret, eh? Never would have thought. Looking at MSDN it appears you're only supposed to call it when your window is about to lose keyboard focus, so I guess this is sort of an unintended bonus. Might even come in handy for a project I'm working on right now. Nice work!

Edited by Sokko
Link to comment
Share on other sites

Well, there actually are Hide/ShowCaret functions. I was just destroying. I guess this is more 'proper.' :shocked:

#include <GUIConstants.au3>

$hidden = False

GUICreate('My Hide Caret', 220, 180)
$edit = GUICtrlCreateEdit('Here is my edit box caret example!', 20, 20, 180, 100, $ES_READONLY)
$btn1 = GUICtrlCreateButton('Show Caret', 20, 140, 80, 26)
$btn2 = GUICtrlCreateButton('Hide Caret', 120, 140, 80, 26)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btn1
            DllCall('user32.dll', 'int', 'ShowCaret', 'hwnd', '')
            GUICtrlSetState($edit, $GUI_FOCUS)
        Case $btn2
            GUICtrlSetState($edit, $GUI_FOCUS)
            DllCall('user32.dll', 'int', 'HideCaret', 'hwnd', '')
    EndSwitch
WEnd
Edited by xcal
Link to comment
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
 Share

  • Recently Browsing   0 members

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