SetTextArea() Slider issue
BlitzMax Forums/BlitzMax Programming/SetTextArea() Slider issue
| ||
There is an issue with settextarea and sliders. If you update a text with via this command the vertical slider is not reset to its 0 value. Thus the "new" text is already scrolled to the last set position. A workaround for this is setting the textarea empty with "" and afterwards setting the new text. But this causes a visual flickering as the box needs to be updated twice. :( Example code: SuperStrict Global MyWindow:TGadget=CreateWindow("My Window with WINDOW_TITLEBAR", 200,200,400,400,Null,WINDOW_TITLEBAR) Global MyText:TGadget=CreateTextArea(10,20,370,280,MyWindow, TEXTAREA_WORDWRAP) Global MyButton:TGadget=CreateButton("Add Text?",10,340,100,30, MyWindow,BUTTON_OK) Global txt$="------- EMPTY TEXTAREA ------------------" SetTextAreaText(MyText,txt$) txt="" For Local i:Int=0 To 1000 txt=txt+" -------------------- Line "+i+" --------------------" Next Repeat WaitEvent() Select EventID() Case EVENT_GADGETACTION ' SetTextAreaText(MyText,"") ' <- workaround SetTextAreaText(MyText,txt$) SetGadgetText(MyButton,"More text added!") Case EVENT_WINDOWCLOSE End End Select Forever End To see this issue: Click on the button one time. Scroll down the slider to bottom or elsewhere. Click on the button again. I think the textarea command should do like the workaround by default? Grisu |
| ||
I think this is a cursor position issue not a slider issue. SetTextAreaText will only move the cursor if it falls outside the resulting text. Hence SetTextAreaText(mytext,"") forces the cursor to home whereas you will need to call SelectTextAreaText 0,0 to reset the cursor after modifying the text in some other way. |