datgrid display sort of correct [solved]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

datgrid display sort of correct [solved]

Post by mattmaier » Wed Nov 19, 2014 4:32 am

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
Attachments
node editor data grid.PNG
Last edited by mattmaier on Sat Dec 27, 2014 9:37 pm, edited 1 time in total.

mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

Re: datgrid display sort of correct

Post by mattmaier » Sun Nov 30, 2014 6:10 pm

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.

mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

Re: datgrid display sort of correct

Post by mattmaier » Wed Dec 03, 2014 6:07 am

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
Attachments
inspector.PNG

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: datgrid display sort of correct

Post by malte » Wed Dec 03, 2014 10:08 am

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

mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

Re: datgrid display sort of correct

Post by mattmaier » Thu Dec 04, 2014 4:47 am

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!

mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

Re: datgrid display sort of correct

Post by mattmaier » Sat Dec 27, 2014 9:36 pm

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

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”