rnbw
New Member
Posts: 48
|
Post by rnbw on Feb 21, 2022 7:16:44 GMT -5
Can a textbox be multiline, with wordwrap? How would you create it/
I find that if I try to create a textbox say 300 deep, it will simply show it as a single line at the bottom of where a 300 deep textbox would be.
|
|
|
Post by Rod on Feb 21, 2022 8:17:44 GMT -5
Well this is straight out of the LBPE. Janet showed us how to create a multiline textbox with word wrap. There is a typo in the help file which prevents the second example running, just a mistake in the handle, #main instead of correctly #Main.
Perhaps something else is forcing your text to the foot of the textbox.
Nomainwin WindowWidth=300 WindowHeight=160
text1$ = "STYLEBITS allows you to change the style of a Liberty BASIC window or control." text2$ = "Add to or edit this text."
Textbox #Main.txtbx, 0, 0, 190, 68 'Stylebits #Main.txtbx, _WS_VSCROLL OR _ES_MULTILINE, _ES_AUTOHSCROLL, 0, 0 Stylebits #Main.txtbx, _WS_THICKFRAME OR_ES_MULTILINE, _ES_AUTOHSCROLL, 0, 0 Statictext #Main, text2$, 5, 80, 190, 30
Open "LineWrap for LB" for Window_nf as #Main Print #Main, "Trapclose EndDemo" Print #Main, "Font Times_New_Roman 12 Bold" Print #Main.txtbx, text1$ Wait
Sub EndDemo handle$ Close #Main End End Sub
|
|
|
Post by Walt Decker on Feb 21, 2022 9:50:36 GMT -5
The trick is in the STYLEBITS:
' ES.MULTILINE = HEXDEC("&H0004") ES.AUTOHSCROLL = HEXDEC("&H0080") ES.AUTOVSCROLL = HEXDEC("&H0040") ES.WANTRETURN = HEXDEC("&H1000") ES.NOHIDESEL = HEXDEC("&H0100") WS.VSCROLL = HEXDEC("&H00200000") WS.HSCROLL = HEXDEC("&H00100000")
Style = WS.VSCROLL OR ES.MULTILINE OR ES.AUTOVSCROLL OR ES.WANTRETURN OR _ ES.CHILD OR ES.WANTRETURN OR ES.NOHIDESEL
STYLEBITS #DMO.TXBL, Style, WS.HSCROLL OR ES.AUTHOHSCROLL, 0, 0 TEXTBOX #DMO.TXBL, 0, 0, 500, 500 '
Use CTRL + ENTER to insert a CRLF or check for VK.RETURN = HEXDEC("&H0D") during a timer event using User32.dll API function GetAsyncKeyState() an insert the CRLF yourself.
|
|
rnbw
New Member
Posts: 48
|
Post by rnbw on Feb 22, 2022 6:20:45 GMT -5
Hi Rod and Walt Sorry to send you off on a wild goose chase, I should have made it clear that I was referring to a textbox in LB5.
|
|
|
Post by Walt Decker on Feb 22, 2022 10:09:49 GMT -5
My bad. Not your fault. Perhaps we just did not pay attention to the thread title (in my case). Mr. Gundel is putting everthing in "widgits" so manipulating controls to suit your needs will fall into an entirely new ballpark, one in which I cannot help you.
|
|
|
Post by Rod on Feb 22, 2022 10:21:07 GMT -5
Yeah sorry, in my case I jump in from the recent posts link which kinda hides the board title. I sure hope we get some of the functionality that many folks have delved into API and stylebits for in the past.
|
|