October 06, 2022, 08:34:54 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Info Only Update - 08-09-2014

Started by LarryMc, August 09, 2014, 10:32:12 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

I just ran into a huge snag on the grid control.
Discovered it while working on the help manual.  I wanted screen shots of each cell type for the sections that coveres what each type is for and how to use it.
I was working on the 1st cell type(@IWGANY) which allows for any printable character to be entered in the field.
This type was really intended for displaying data like what is contained in a database memo field.
The variable that I use to read and right the data is a 5000 character ISTRING.

Although my grid might look like a LISTVIEW it is not.  It is completely hand drawn.
However, all the data for configured cells is stored in several hidden indexed listviews.
For the help file I want to show how the editing dialog for the cell would allow lots of text to be display.

To my surprise I found that when I pasted in 400 characters that the data was truncated after saving and then reediting.

As it turns out a column in a listview can only display 260 characters.  You can write as many characters as you want to but you can only read the 1st 260 back out.
After searching the net it appears that this is a shortcoming of a window's listview control with no simple work around.

So, I've determined I Have just a few options.
1) store the text in ISTRING created with NEW and then store the pointer in the listview.
This option would require extra code in all the places that I read and write the data to convert the pointer value to a string for storage and then converting it back to a number to use it as a pointer reference. There would also need to be cleanup code so as not to leave a pointer un-cleared and create memory leaks.
2) Is to convert from listviews to listboxes and to create a CHAR array with the new command and then to put all my data currently stored in the multiple hidden listviews into a STRUCT and save it into the array.  And the resulting array would be stored in the listbox.

I've got to do further studying but I believe the 1st option is going to involve the least amount of rework between the two options.

The bottom line is it going to take me a considerable amount of time to make all the necessary changes AND test to make sure I don't break something else.

Update: Just realized that this problem also impacts the total length of all options in a IWGCOMBO type cell.

In researching how to fix the problem I found that the code that is displaying the text doesn't like anything over 254 characters also; it causes the grid to go blank.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

You could always just put it into the documentation, as a note, that it is a limitation of the Listview.  Or, just maybe make it some thing that can be clicked on and it pulls up another window/dialog with a text/rtf screen with the Memo field in it.  In other words, make MEMO fields a special case that ends up pulling up a dialog box with the info in it.

Just a thought,
Bill
When all else fails, get a bigger hammer.

LarryMc

Quote from: billhsln on August 09, 2014, 11:25:09 AM
... Or, just maybe make it some thing that can be clicked on and it pulls up another window/dialog with a text/rtf screen with the Memo field in it.  In other words, make MEMO fields a special case that ends up pulling up a dialog box with the info in it.

That's what I'm already doing Bill.  But the raw data has to be stored somewhere(the grid control isn't designed to just load a database). And not all cells are configured.  If you have a grid that is 50 cells wide and 1000 columns long you're talking 250 meg+ just for the text storage alone.

My 1st option above is what I should have done in the first place. I can make the storage required mach the size of the data and will save me a ton of memory in most cases.

In the beginning I had no idea to build a good grid control.
We all live and learn; AND I've always said I was just a shade tree programmer.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library