Page 1 of 1

datgrid display sort of correct [solved]

Posted: Wed Nov 19, 2014 4:32 am
by mattmaier
I've got this datagrid that's drawing the right thing but it's kind of like it's own graphic on top of the default datagrid.
In the attached image, I resized the window a bit to expose the difference between the stuff that's being drawn and the default datagrid "underneath." This version has scrollbars but they're disabled, even if the stuff it draws extends below the edge of the window. I guess that's because the scrollbars are attached to the underlying default datagrid that's empty. When it refreshes the new stuff correctly fits whatever size the window happens to be.

This is what I've got for these handlers:

Code: Select all

on FillInData pDataArray
   -- This message is sent when the Data Grid needs to populate
   -- this template with the data from a record. pDataArray is an
   -- an array containing the records data.
   -- You do not need to resize any of your template's controls in
   -- this message. All resizing should be handled in resizeControl.
   
   -- Example:
   -- set the text of field "Label" of me to pDataArray["label 1"]
   
   --         put word 1 of tLine into theDataArray[tLine]["type"]
   --      put word 2 of tLine into theDataArray[tLine]["weight"]
   --      put word 3 of tLine into theDataArray[tLine]["target"]
   
   -- Actual:
   set the text of field "weightField" of me to pDataArray["weight"]
   set the label of button "typeOptionMenu" of me to pDataArray["type"]
   set the label of button "nodeMenu" of me to pDataArray["target"]
end FillInData


on LayoutControl pControlRect
   local theFieldRect
   
   -- This message is sent when you should layout your template's controls.
   -- This is where you resize the 'Background' graphic, resize fields and 
   -- position objects.
   -- For fixed height data grid forms you can use items 1 through 4 of pControlRect as
   -- boundaries for laying out your controls.
   -- For variable height data grid forms you can use items 1 through 3 of pControlRect as
   -- boundaries, expanding the height of your control as needed.
   
   -- Example:
   --    put the rect of field "Label" of me into theFieldRect
   --    put item 3 of pControlRect - 5 into item 3 of theFieldRect
   --    set the rect of field "Label" of me to theFieldRect
   
   put the rect of button "nodeMenu" of me into theFieldRect
   put item 3 of pControlRect - 5 into item 3 of theFieldRect
   set the rect of button "nodeMenu" of me to theFieldRect
   
   set the rect of graphic "Background" of me to pControlRect
end LayoutControl

Re: datgrid display sort of correct

Posted: Sun Nov 30, 2014 6:10 pm
by mattmaier
Now the other datagrid in my application has suddenly started doing the same thing. It always worked properly, but now it's scrollbar doesn't work and it looks like it's just overlaying rows with content on top of the default datagrid.

Re: datgrid display sort of correct

Posted: Wed Dec 03, 2014 6:07 am
by mattmaier
Putting this here because it's easier for responding to the mailing list, and it makes sense to put the info for this topic in one place.
Also, I'm using version 7 (rc 1) on Windows 8.1

Re: datgrid display sort of correct

Posted: Wed Dec 03, 2014 10:08 am
by malte
Hi Matt,

please try the following. In the messagebox:

put true into gRevDevelopment -- this will force to output error messages that are swallowed by the IDE

after that, try to populate your grid again and check if it throws any errors.

Hope that helps,

Malte

Re: datgrid display sort of correct

Posted: Thu Dec 04, 2014 4:47 am
by mattmaier
That didn't produce any errors. I tried several ways, like resetting the IDE, and refreshing with script, and refreshing from the property manager. No errors.

I also tried different options under layer mode; no affect.

Older versions of the application have a datagrid that still scrolls just fine. Something changed. Aaargh!

Re: datgrid display sort of correct

Posted: Sat Dec 27, 2014 9:36 pm
by mattmaier
It seems fixed. The scrollbar disappeared when I fed a non-numeric key into dgData and the scrollbar reappeared whenever all of the keys were numeric. So I added a counter that ensures there's a numeric key for every entry in dgData since the array I'm pulling from has a couple non-numeric keys.

It's mentioned in the description of dgData here http://lessons.runrev.com/m/datagrid/l/ ... a-grid-api