|
Post by pablosl on Mar 3, 2022 14:43:04 GMT -5
Hi,
In this thread:
1) Is mentioned that one can use chr$(10) or chr$(13) in a listbox.
2) User can handle an horizontal scroll bar.
Can somebody show me some code to do this 2 things?.
Thank you in advance.
-Pablo
P.S. This is the code I have been working with:
nomainwin
dim array$(10)
array$(1)= "Hello, this is a very long line of text."
array$(2)= "How can I do "+chr$(10)+chr$(13)+"can't show this text!"
WindowWidth = 600
WindowHeight = 400
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
STYLEBITS #main.listbox1, WS.HSCROLL, 0, 0, 0
listbox #main.listbox1, array$(, [listbox1DoubleClick], 26, 16,144, 245
open "My Budget Planner V0.01" for window as #main
print #main, "trapclose [fin]"
h1 = hwnd(#main)
CALLDLL #user32, "SendMessageA", h1 AS ULONG, LB.SETHORIZONTALEXTENT AS ULONG, 150 AS LONG, 0 AS LONG, RetVal AS VOID
print #main, "font ms_sans_serif 10"
wait
[fin]
Close #main
END
[listbox1DoubleClick] 'Perform action for the listbox named
'listbox1'
'Insert your own code here
wait
|
|
|
Post by Walt Decker on Mar 3, 2022 18:50:59 GMT -5
You did not follow the instruction for a horizontal scrollable list box. You have not defined WS.HSCROL and LB.SETHORIZONTALEXTENT. They are defined in the referenced thread.
|
|
|
Post by pablosl on Mar 3, 2022 19:09:27 GMT -5
Ha!!! Thank you very much!!. Now I see an horizontal scroll bar!. But still see the message "Hello, this is a very long line" not the last word. Do not know why.
I still do not understand point 1) How to use chr$(10)+chr$(13)
Thank you so much.
-Pablo
|
|
|
Post by Rod on Mar 4, 2022 2:37:12 GMT -5
Perhaps you could give us a text example of what you are trying to display. Listboxes are supposed to be single line and by their nature if being a list they are supposed to be short.
So tell us in more detail what you are trying to build.
The chr$(13) trick is simply to shorten the display line but keep the rest of the line hidden. It is useful to keep data accessible in a single array for database applications. It is not for displaying long info.
|
|
|
Post by Walt Decker on Mar 4, 2022 9:10:44 GMT -5
Probably because your width is not large enough. For accurate sizing you should find the client area of the listbox, find the width of the font, multiply the font width by the number of characters in the longest string and add that to the listbox client area width. For a quick approximation multiply the string length by 16 and add that to the overall width of the listbox.
As for the use of CR in a listbox string, I have never used it and really see no reason for it.
|
|