LB Booster
« Long text input? »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:52am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Long text input?  (Read 935 times)
Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Long text input?
« Thread started on: Feb 8th, 2015, 5:59pm »

Hi Richard, I just noticed that the main window doesn't scroll to the right automatically if the user is entering a long line of text at an input statement. The text just disappears off the right of the window and then drops down to a new line after a certain number of characters have been entered (239 I think). Is there a way to word wrap the main window or define the number of characters per line so they will fit inside the width of the main window? Thank you.
« Last Edit: Feb 8th, 2015, 6:01pm by Monkfish » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Long text input?
« Reply #1 on: Feb 8th, 2015, 8:22pm »

on Feb 8th, 2015, 5:59pm, Monkfish wrote:
Hi Richard, I just noticed that the main window doesn't scroll to the right automatically if the user is entering a long line of text at an input statement.

Given that the 'visible' width of the mainwin is 80 characters (by default) it would have to be an extraordinarily long line! I'm not sure I can imagine a situation in which it would be reasonable to expect the user to type in that much data, with only the crude line-editing facilities available.

Are you sure your application really suits a 'mainwin' program? Have you considered the alternative of using a GUI control for the user to enter the data (e.g. a TEXTEDITOR control)? Editing facilities are much improved, it could be configured for word-wrap, and even pasting from the clipboard would be supported.

Quote:
Is there a way to word wrap the main window or define the number of characters per line so they will fit inside the width of the main window?

You could set the right-hand margin, but that would only do a character-wrap rather than a word-wrap.

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Long text input?
« Reply #2 on: Feb 8th, 2015, 9:24pm »

Thank you. How would I set the margin?

There is only one point in my program that allows the user to enter a long line of text. I'm trying to keep the program as simple as possible for novice computer users, so I don't really want separate windows popping up if I can avoid it.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Long text input?
« Reply #3 on: Feb 8th, 2015, 10:34pm »

on Feb 8th, 2015, 9:24pm, Monkfish wrote:
Thank you. How would I set the margin?

http://bb4w.wikispaces.com/Arabic+text+on+the+mainwin+and+printer+%28LBB%29

(about half-way down the page). But I really would urge you to find a better solution, for the sake of the 'novice' users!

Richard.
User IP Logged

SarmedNafi
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 93
xx Re: Long text input?
« Reply #4 on: Feb 9th, 2015, 04:18am »

Richard,

Dear Golf Four Bravo,
The page of the link you mentioned to:

http://bb4w.wikispaces.com/Arabic+text+on+the+mainwin+and+printer+%28LBB%29

Has the subject:
And finally some Arabic text sent to the mainwin:
Followed with the code...
The result of running the code on a PC supported for complex script and write to left language. Gives the Arabic two sentences written with isolated letters not normal connected letters, I hope you will have some time to fix this.
I think the problem is with the LBB main win control which is not supported Arabic language at all.
They were write alignment and the text direction seems correct but the letters isolated which it is not correct.
Please NOTE, I am not post this to annoying you as you said or such. I am not hate you as you said.
We have locally in our culture that the Nobel men must be as mirrors to each of them.
I thank you a lot for all help you presents to us.

Regards,
YI1SN
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Long text input?
« Reply #5 on: Feb 9th, 2015, 09:15am »

on Feb 9th, 2015, 04:18am, SarmedNafi wrote:
Gives the Arabic two sentences written with isolated letters not normal connected letters

Here is a screen grab of the output of the code listed at that wiki page (here from Windows XP, but I've tested it on everything from Windows 2000 to Windows 8.1):

User Image

To my eyes, that shows 'connected' Arabic script, not 'isolated letters'. If you don't see the same on your screen, it would suggest there is something amiss with your Unicode or Fonts installation.

Quote:
I think the problem is with the LBB main win control which is not supported Arabic language at all.

That's a rather odd thing to say, given that the objective of the wiki article is to demonstrate that it is possible to display Arabic in the LBB mainwin!

Quote:
Please NOTE, I am not post this to annoying you as you said or such.

I cannot comment on your intentions, but your message is 'off topic' for this thread. It would have been better to start a new one.

Edit: I've now added the grabbed image to the wiki article, so everybody knows what they should expect to see.

Richard.
« Last Edit: Feb 9th, 2015, 10:32am by Richard Russell » User IP Logged

SarmedNafi
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 93
xx Re: Long text input?
« Reply #6 on: Feb 9th, 2015, 2:00pm »

Richard,

I found the cause.
I was not checked Unicode support under options menu.
Now it is worked.
It displayed Arabic correct on main win.
This option, How to remember it easily?
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Long text input?
« Reply #7 on: Feb 9th, 2015, 2:20pm »

on Feb 9th, 2015, 2:00pm, SarmedNafi wrote:
I found the cause.
I was not checked Unicode support under options menu.

In the wiki article it says "remember to enable Unicode support in the Options menu" and then later "again, remember to enable Unicode support". I do expect you to read the text. rolleyes

Here, if that option is not selected I just see 'question marks', so it is obvious. It had not occurred to me that if your PC is configured for code page 1256 you would see Arabic characters (but not the right ones).

Quote:
This option, How to remember it easily?

If you save the program, you will find that the option is automatically re-selected when you load it again. It is therefore not necessary to 'remember', except when the program is first created.

In the next release of LBB the Unicode/ANSI setting is displayed in the Status Bar, so may be easier to spot (ANSI meaning 'your local code page' as it usually does in Windows).

Can I delete the earlier messages in this thread so as not to mislead?

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Long text input?
« Reply #8 on: Feb 12th, 2015, 11:06am »

I took your advice Richard and made a text box. The code below works fine but I was looking for a way to position the cursor at the end of the text in the box instead of the beginning. Just putting a semi-colon at the end of the printed sampletext$; didn't seem to work. So I thought I would use the !lines control to get the number of lines of text, then the !line control to get the last line and from that its length, and finally the !select control to position the cursor. But the program objects to the four commented out lines in the following code.

text$=""
WindowWidth=400
WindowHeight=200
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
textbox #main.tbx, 10, 10, 330, 150
stylebits #main.tbx, _WS_VSCROLL OR _ES_MULTILINE, _ES_AUTOHSCROLL, 0, 0
button #main, " OK ", [accept], UL, 345, 72
open "Edit the text and then press OK" for Dialog as #main
print #main, "trapclose [ignore]"
print #main, "font courier_new 12 bold"
print #main.tbx, sampletext$
' print #main.tbx, "!lines r"
' print #main.tbx, "!line ";r;" l$"
' c=len(l$)
' print #main.tbx, "!select ";c;" ";r
wait

[accept]
flg=1
print #main.tbx, "!contents? text$"
close #main
end

[ignore]
flg=0
close #main
end
« Last Edit: Feb 12th, 2015, 7:30pm by Monkfish » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Long text input?
« Reply #9 on: Feb 12th, 2015, 1:02pm »

on Feb 12th, 2015, 11:06am, Monkfish wrote:
But the program objects to the four commented out lines in the following code.

What program? LB 4.04 objects to those commands, because they are TEXTEDITOR commands, not TEXTBOX commands. But LBB doesn't complain - it just ignores them (in general LBB doesn't report an error if a command is inappropriate for the control type to which it is sent).

Could you use a TEXTEDITOR control (LBB is happy for one to be used in a DIALOG window)? Failing that, there's code at one of the LB support sites for using a Windows API call to position the caret in a TEXTBOX.

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Long text input?
« Reply #10 on: Feb 12th, 2015, 7:20pm »

Thanks for the pointers smiley
This now seems to work...

text$=""
WindowWidth=400
WindowHeight=200
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
textbox #main.tbx, 10, 10, 330, 150
stylebits #main.tbx, _WS_VSCROLL OR _ES_MULTILINE, _ES_AUTOHSCROLL, 0, 0
button #main, " OK ", [accept], UL, 345, 72
open "Edit the text and then press OK" for Dialog as #main
print #main, "trapclose [ignore]"
print #main, "font courier_new 12 bold"
print #main.tbx, sampletext$
pos=len(sampletext$)
hTextbox=hWnd(#main.tbx)
CallDLL #user32, "SendMessageA", hTextbox as Ulong, _EM_SETSEL as Long, pos as Long, pos as Long, result as Long
wait

[accept]
flg=1
print #main.tbx, "!contents? text$"
close #main
end

[ignore]
flg=0
close #main
end
« Last Edit: Feb 12th, 2015, 7:34pm by Monkfish » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls