DataGrid and Disappearing Column Labels

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

DataGrid and Disappearing Column Labels

Post by rrBUSS9EE » Sun Jun 17, 2012 10:50 pm

I started to see this in my stack a few days ago. Now it is happening a lot.

Anyone know the cause for this and how to refresh them. Obviously clicking the "Refresh Data Grid" button in the property inspector brings them back, but that is not going to be an option in the finished app.

P.S. Sorry for the double post as I original put this in "Mac OS" as that is what I am developing on, but thought more folks would notice it here. Mods… feel free to delete the other one.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10356
Joined: Wed May 06, 2009 2:28 pm

Re: DataGrid and Disappearing Column Labels

Post by dunbarx » Mon Jun 18, 2012 4:50 am

I don't think there is an explicit "refresh" command, but you can refresh a dataGrid under script control in a few ways. For example,

set the dgDataOfIndex[the dgHilitedIndex of group "yourDataGrid" ] of group "yourDataGrid" to someNewData --someNewData could be just the original row array.

This begs the issue of why the labels are hiding. I found a similar sort of issue in a project, where the first row would disappear now and then, as if I scrolled down one line. I had no scrollbars at all. Refreshing fixed this, though I ultimately made the glitch go away by including the horizontal scrollbar and accepting a slightly taller DG object.

So there are peculiarities with dataGrids, however cool and powerful they are. You have to indulge them. But it might be worrisome if others have to depend on them. This makes their use in a standalone dicey, I think, unless these kluge fixes are rock solid.

Craig Newman

rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

Re: DataGrid and Disappearing Column Labels

Post by rrBUSS9EE » Mon Jun 18, 2012 2:57 pm

Thanks… but I could never label anything "cool and powerful" that does not work. These are very simple (almost default) Datagrids populated via dgText from a simple SQLite database. Resetting the dgText does nothing to help redraw the missing column labels.

Odd that the DG I am having the most problems with has both H and V scrollbars (the others only V).

I am curious what the refresh button in the Prop Inspector is doing, and if I could do that by script.

Klaus
Posts: 14212
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: DataGrid and Disappearing Column Labels

Post by Klaus » Mon Jun 18, 2012 3:26 pm

Hi rrBUSS9EE,

column labels do not disappear out of a sudden!
Once set, they will stay unless deleted or set anew via script.

I guess you are using something like:
...
put true into firstLineContainsColumnNames
set the dgText[firstLineContainsColumnNames] of group "DataGrid" to tYourDatabaseResultsHere
...
If you do please make sure that the column labels are really always present and complete!


Best

Klaus

rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

Re: DataGrid and Disappearing Column Labels

Post by rrBUSS9EE » Mon Jun 18, 2012 3:56 pm

Hi Klaus,

No. My data has no column names so I am just using:

set the dgText of group <groupname> to myData

My data is tab/return delimited as returned from an SQLite table with revDataFromQuery. The column labels are set up in the PI and do not change. When they "disappear" from the grids, they are still intact in the PI, and touching Column Label field by opening it and then hitting the enter key refreshes that column. The Refresh Data Grid button refreshes them all.

These grids are initially populated on preOpenStack, and in other places/times in the stack when changes to the database are made. The labels disappear in a seemingly random pattern when the dgText of the various grids is reset.

Klaus
Posts: 14212
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: DataGrid and Disappearing Column Labels

Post by Klaus » Mon Jun 18, 2012 4:17 pm

Hi rrBUSS9EE,

hm, ok, just wanted to be sure 8)

You can "refresh" the datagrid via script like this:
...
dispatch "ResetList" to group "Your datagrid here"
...

Best

Klaus

rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

Re: DataGrid and Disappearing Column Labels

Post by rrBUSS9EE » Mon Jun 18, 2012 4:44 pm

Thanks Klaus!

Popping that into an openCard handler seems to have done the trick.

Klaus
Posts: 14212
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: DataGrid and Disappearing Column Labels

Post by Klaus » Mon Jun 18, 2012 4:50 pm

Cool! 8)

Post Reply