|
Post by Rod on Jan 14, 2022 10:47:21 GMT -5
I feel we have taken the OP down a route. Should we not have shown a multi textbox solution. Would you not use multiple properly sized textboxes to show structured database data rather than display it in an unstructured way in a multiline textbox or graphic box? Once displayed in an unstructured way how is it edited, how is it listed? But perhaps we have answered the question.
|
|
|
Post by Brandon Parker on Jan 14, 2022 11:31:01 GMT -5
Personally, I would use a ListView control and not worry about coloring a specific column's text.
That being said, there are several solutions to the problem. I only created an example expanding one of Anatoly's suggested solutions.
I do not see where providing differing solutions is forcing anyone down a specific route. No mention was made about editing the data only displaying it. Even if one wanted to use the GraphicBox approach, figuring out which record the user wanted to edit based on clicked position is definitely doable, but not super-easy. The OP did mention that the data was being displayed in a single control, so that is the approach I took to expand upon Anatoly's solution.
If we limit ourselves to only one approach, we miss out on many opportunities to learn and grow as programmers/developers...
It is up to the OP to decide which route is taken from the suggestions provided.
{:0)
Brandon Parker
|
|
|
Post by Rod on Jan 15, 2022 5:09:52 GMT -5
Yes a list view would be ideal but again it isn't the simplest solution. I am not criticising anyones programming or even their comments, all are welcome. I just feel we lost our ability to offer simple guidance to new to Liberty coders. A beginner would struggle with a list view and, even more so with API text. Your graphic box solution is a good solution but I bet the OP was surprised at how different from normal text it is. These are all great techniques but plain vanilla native is my first preference.
I also have a bee in my bonnet about colored text, everyone thinks they need it but in fact onscreen it isn't a great solution. Modern thin colored text is hard to see and never achieves the clarity 8bit blocky fonts used to give. So colouring the background is a solution, not what I would do, but it is easy.
I was also concerned that we were pushing structured data into an unstructured control but that's old database training. Always keep structured data structured.
Ultimately if the task is to display and print multicoloured text then your graphic box solution nailed it. But I am not sure that is the OP's need
nomainwin TextboxColor$ = "red" textbox #w.name 20,10 ,260,25 TextboxColor$ = "white" textbox #w.addr1 20, 40, 260, 25 textbox #w.addr2 20,70,260,25 textbox #w.addr3 20,100,160,25 textbox #w.mobile 20,130,260,25 textbox #w.email 20,160,260,25 WindowWidth = 350 : WindowHeight = 230 open "Data Form" for window_nf as #w #w "trapclose [quit]" #w.name "Rod Bird" #w.addr1 "Somewhere" wait
[quit] close #w end
|
|
|
Post by tsh73 on Jan 15, 2022 7:39:43 GMT -5
Sometimes there is just no simple solution. No easy way to do that in LB.
|
|
|
Post by Brandon Parker on Jan 15, 2022 9:31:40 GMT -5
What I should have said is that I'm displaying all the records in the same text box. Maybe we just need more clarification from the OP. Does the OP want to display all/many records at the same time in one control or does the OP only want to display a single record at a time and just cycle through all of them using the same control (ie. TextBox or similar)? {:0) Brandon Parker
|
|
bobm
New Member
Posts: 7
|
Post by bobm on Jan 16, 2022 18:05:39 GMT -5
Thanks, Brandon, and thanks to everyone else. I haven't had a chance to get to my code, but when I do, I'll let you know how I make out.
|
|