datgrid display sort of correct [solved]
Posted: 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:
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