I have a source procedure PreviewShoppingChoices which displays a listbox after the user has built their mealplan. They can click on a record to remove it from their printout.
At present, the listbox displayed is quite unimpressive, to say the least. I haven’t been able to properly format it. The headers won’t display and all of the columns have been given an equal amount of space, despite the FORMAT directing it to allocate given amounts of width. Changing the Window AT or the List AT values do change the size(width) of each, but the columns remain evenly distributed no matter the size of the listbox.
I attempted to add #FIELDS(SIQ:Foodname, etc.) after the FROM(SIQ) attribute but that brought up several errors:
Unknown attribute: FIELDS
Illegal character - #FIELDS
In the help (F1), there is a section/page called “How to Autosize all Columns in a Browse Box when the Window Opens”.
There is also a help page called “How to add Column Tool Tips to a List Box”, this can be useful for when a column is not wide enough to display the full cell text but hovering the mouse over the column cell, will show the full text in the mouse tip.
If you dont want to restore the column widths automatically, there is also a help page titled “How to Restore User Resized List Box Column Widths” which uses the ini file to save and restore user resized columns.
Those should give you the code examples to get you going.
I didnt look at your code, but if you want a tip, you can store one or more column formats in a string, and then build the format by piecing the strings together.
I found that to be quite handy, for what I needed as it was easier to edit an individual string than the entire format string, because I was hiding and showing columns.
In the List Parser Tool you paste your entire LIST code including FORMAT and #Fields (App only) into the 1st tab named “LIST”, then click the “Process List” button. The 2nd tab will have the Format() split into 1 column per line. There is a “Copy Format” button for pasting it back into your code.
I like it in the one column per line format for being easy to read and understand the FORMAT. To see the pictures, alignments and indents are consistent.
There is a Preview feature that will show you any List FORMAT without writing a program. You can resize and reformat the columns in the live list to see what works best. The Designer is not 100% accurate.
I would think you would want your @N Number columns Right aligned i.e. you have them L(2) so they are ragged on the right, try R(4)
Nutrition Labels in USA are in the opposite order: Fat, Carbs, Protein
You might look at PROP:PropVScroll for a proportional thumb on the scroll bar otherwise you always get a square.
You can have a 2 line heading to show the full word “Servings” by adding a CRLF <13,10>. I usually use Hex <0Dh,0Ah> as it works better in the Designer i.e. it displays correctly.
You’re right! I’m trying to think back as to why I decided to list them differently in a browse or report. I’m certainly not a nutritionist, just a pharmacist.
If I were to guess why I did it, it’s because, in a list we tend to look from left to right.
My line of thinking (at that time) might have been:
Protein is more ‘healthy’ than carbs, which are more healthy than fats.
So let me list them that way.
When I created the update form, I actually followed the nutritional labels that are on each food, as you can see.
Are you aware that you can press Ctrl-D in the data section of source code and the Clarion window designer will open and you can format your list visually?
Sorry if it’s a dumb question, but I’m not sure why you are writing lists by hand, if that’s what you are doing?
Thanks for telling me this. I had no idea. The truth is, I was one of those ‘dumb’ people way back when Clarion first came out that chose not to learn the programming side of clarion. Now I’m stuck in ‘dumb land’ because nobody teaches it, but if you’ll continue to answer my questions, I’ll really appreciate it. I am now Reading The F’ing Manuals regularly.
I had actually found the last piece to the window ‘puzzle’ a couple of hours prior to your response, but should I ever choose to work on a window in source again, your tip will be invaluable.
I’ll confess that the reason I found myself in this situation was because I had asked ChatGPT to help with a big project.