[JASS] Setting scrollable text area to the start and focusing the scrollbar

Level 28
Joined
Feb 2, 2006
Messages
1,630
Hi,
I have two more questions about text area frames.

Question 1: How to set a scrollable text area to the start?
For a UI system I create a scrollable text area:

JASS:
set TextAreaFrame = BlzCreateFrame("EscMenuTextAreaTemplate", BackgroundFrame, 0, 0)
call BlzFrameSetAbsPoint(TextAreaFrame, FRAMEPOINT_TOPLEFT, TEXT_AREA_X, TEXT_AREA_Y)
call BlzFrameSetAbsPoint(TextAreaFrame, FRAMEPOINT_BOTTOMRIGHT, TEXT_AREA_X + TEXT_AREA_WIDTH, TEXT_AREA_Y - TEXT_AREA_HEIGHT)
call BlzFrameSetFont(TextAreaFrame, "MasterFont", 0.011, 0)

and add some text at some point:

JASS:
call BlzFrameSetText(TextAreaFrame, "")
loop
    exitwhen (i == max)
    call BlzFrameAddText(TextAreaFrame, "bla")
    set i = i + 1
endloop

It always scrolls to the end of the text area when the frame is shown.
How can I scroll to the first line, so the player can read the text from the start?

Question 2: How to focus the scrollbar of a scrollable text area?

Besides, is there any way to really focus the the text area's scrollbar, so that the player does not have to move the mouse cursor on the scrollbar.
The issue is that my text area is further away from the button and the content changes whenever the cursor will hover another button, so the player has to move the cursor all the way around the buttons to get to the scrollbar and then back to another button to hover on it.

I have tried
JASS:
BlzFrameSetLevel
with level 1 and then
JASS:
BlzFrameSetFocus
with true but it did not work. I suspect I have to get the actual scrollbar frame from the text area and focus it? But I don't know which child it is and if that really works.


I did not find the solutions in UI: TEXTAREA the scrolling Text Frame
It would be helpful to add them to the tutorial if they exist.
 
Top