Page 1 of 1

Datagrid - adding line under variable height records

Posted: Fri Jan 02, 2015 4:38 pm
by Simon Knight
Hi,

Happy new year !

I am trying to display a line under a variable height field on a datagrid form. I have defined a line in the row template and attempt to move it in the Layoutcontrol handler. However, I have tried using the points of the line, the location of the line and the rectangle of the line but none have worked. The line gets moved but does not display for all records. My latest failure is listed below.

Code: Select all

  -- rect 1-left, 2-top, 3-right, 4-bottom
   -- Now place the line that acts as a record separation
   -- first increase the size of the record by six pixels
   put (item 4 of pControlRect +6) into item 4 of pControlRect
   
   put the points of graphic "MyLine" of me into tPoints  -- starting point for the size and position of line
   -- two points per line
   Put line 1 of tPoints into tStartCoOrd  -- X fom left , Y from top  
   Put line 2 of tPoints into tEndCoOrd
   
   put item 4 of pControlRect into item 2 of tStartCoOrd
   put item 4 of pControlRect into item 2 of tEndCoOrd
   put tStartCoOrd & CR & tEndCoOrd into tNewPosn
   set the points of graphic "MyLine" to tNewPosn
   
   -- resize the bounding rectangle to match the resized field
   set the rect of graphic "Background" of me to pControlRect
   ------
   
   SetForeGroundColor
end LayoutControl

Re: Datagrid - adding line under variable height records

Posted: Fri Jan 02, 2015 4:46 pm
by Simon Knight
Hi,
My datagrid fails to display the graphic line if I make any attempt to move it, it may be something to do with refreshing the grid but using the following code I attempted to move the line 10 pixels to the right:

Code: Select all

-- Now place the line that acts as a record sep
   -- first increase the size of the record by six pixels
   put (item 4 of pControlRect +20) into item 4 of pControlRect
   
   --set the bottom of graphic "MyLine" to the bottom of graphic "MyLine" + 10
   set the right of graphic "MyLine" to the right of graphic "MyLine" + 10

   -- resize the bounding rectangle to match the resized field
   set the rect of graphic "Background" of me to pControlRect
   ------
only the first record displayed the line in its new location (ten to the right), when I refreshed the grid the line moved back to its original position as defined on the template. Any thoughts ?

best wishes

Simon K

Re: Datagrid - adding line under variable height records

Posted: Mon Jan 12, 2015 1:58 am
by Simon Knight
I have a sort of answer: first do not alter the values in the string passed as pControlRect as it may cause problems. Second it seems to me that a line causes a problem because the datagrid does not allow a line to increase the height of a line in a form. My line has item 2 = item 4 in its rect which may also cause a/the problem. However, if I resize the background graphic before I move the line AND I position the line no closer than 2 pixels from the bottom of the graphic then the line is displayed. If I move the line first followed by the graphic then the line is not displayed.