curly
New Member
Posts: 10
|
Post by curly on Jan 7, 2021 15:26:44 GMT
Hi, Now running full Liberty Basic. I want to fill a window with text? Is there an easy way to insert paragraphs please? If I try to put a paragraph of text into statictext, it all appears on one line, disappearing down the road!
|
|
|
Post by tsh73 on Jan 7, 2021 15:45:12 GMT
Just notice this is Just BASIC forum Just BASIC could not handle some tricks Liberty BASIC has.
StaticText normally wraps text. May be you just didn't give enough height for statictext control? in code below
statictext #main.statictext2, txt$, 14, 21, 352, 335 335 is control height, allowing for several lines.
' Form created with the help of Freeform-J v.261006 ' Generated on Jan 07, 2021 at 18:35:43
nomainwin
WindowWidth = 550 WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
groupbox #main.groupbox1, "This is just to show static text bounds", 6, 6, 376, 365 txt$="This is big StaticText" statictext #main.statictext2, txt$, 14, 21, 352, 335 button #main.button3, "add Paragraph", [button3Click], UL, 398, 16, 122, 25
open "Static text word wrap demo" for window as #main print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10"
wait
[quit.main] Close #main END
[button3Click] 'Perform action for the button named 'button3' i=i+1 'notice i txt$=txt$+chr$(13)+" "+"This is ";str$(i);" paragraph. "+ _ "Due to way StaticText works, it will autowrap. "+ _ "You can add manual line wraps with chr$(13)."
#main.statictext2 txt$ 'there no scrollbars in static text - if you have it over, you will not see it wait
|
|
|
Post by B+ on Jan 8, 2021 13:24:43 GMT
Never mind tsh73 has it covered.
|
|
curly
New Member
Posts: 10
|
Post by curly on Jan 10, 2021 11:39:49 GMT
Hi again,
Thank you for all your help so far - this Liberty Basic is so much more interesting than what I used in the 80s!
Thanks to your help, I'm now collecting and saving my data to a 2 dimensional array, using a mix of textboxes and comboboxes.
I have two buttons, one to recall the last set of data and populate the empty text and combo boxes, and the other that saves the current data, overwriting the 2 dimensional array.
All the data for the textboxes comes back fine, but I cannot get it into the comboboxes. I have now created a tiny bit of code as follows and tried multiple variations to no joy,
The array applied to the combobox is a$(5) - a$(3)is "NICE" - I want to populate the field of the combobox with NICE
I have tried so many different combinations, help please.
a$(3) = "NICE" print #DataIn.combobox2, "!select" a$(3) ' returns syntax error print #DataIn.comboboc2, "!select a$(3)" ' fills box with a$(3)- not NICE print #DataIn.combobox2, "!contents a$(3)" 'fills box with a$(3) - not NICE print #DataIn.combobox2, "!contents" a$(3) 'returns syntax error
|
|
|
Post by Rod on Jan 10, 2021 14:09:19 GMT
Please start a new thread when you have a new question that does not match the thread title.
nomainwin WindowWidth = 800 WindowHeight = 400 'nomainwin a$(1) = "one" a$(2) = "two" a$(3) = "three" a$(4) = "four" combobox #win.combo, a$(),[comboclick],10,10,120,200 open "Combobox Demo" for window as #win #win "trapclose [quit]"
#win.combo "selectindex 3" #win.combo "select three" #win.combo "select ";"three" wait
[comboclick] wait
[quit] close #win end
If the array is changed after the combobox control is created you will need to reload the combobox. You must keep the array$() up to date so any input to a combobox must be copied to the array and a reload command executed.
|
|
curly
New Member
Posts: 10
|
Post by curly on Jan 11, 2021 13:53:33 GMT
Thank you, sorry, will do.
|
|
curly
New Member
Posts: 10
|
Post by curly on Jan 11, 2021 15:18:22 GMT
Hi Rod, but just to finish this,I wanted to use a string variable from the designated array as the argument, such as #win.combo "select ";a$(x) where x = 3
|
|
|
Post by Rod on Jan 11, 2021 17:45:27 GMT
nomainwin WindowWidth = 800 WindowHeight = 400 'nomainwin a$(1) = "one" a$(2) = "two" a$(3) = "nice" a$(4) = "four" combobox #win.combo, a$(),[comboclick],10,10,120,200 open "Combobox Demo" for window as #win #win "trapclose [quit]"
'all of these selection methods work '#win.combo "selectindex 3" '#win.combo "select nice" '#win.combo "select ";"nice" x=3 #win.combo "select ";a$(x) 'a$(3)="nice" wait
[comboclick] wait
[quit] close #win end
|
|
curly
New Member
Posts: 10
|
Post by curly on Jan 12, 2021 13:53:31 GMT
Thank you very much - no more now on this thread - thank you for your patience
|
|