Page 1 of 1
DataGrid LayoutControl
Posted: Fri Jun 21, 2013 5:10 pm
by garyth123
What do the items in on LayoutControl mean?
eg
put the rect of field "Name" of me into theFieldRect
put item 1 to 4 of pControlRect into item 1 to 4 of theFieldRect
set the rect of field "Name" of me to theFieldRect
put the rect of field "Stadium" of me into theFieldRect
put item 1 to 4 of pControlRect into item 1 to 4 of theFieldRect
set the rect of field "Stadium" of me to theFieldRect
is giving me what can be seen in the attached png. I thought this would be correct for a fixed height layout. Clearly there is something I don't understand. Can anyone help?
Re: DataGrid LayoutControl
Posted: Fri Jun 21, 2013 5:30 pm
by Klaus
Hi Gary,
I'm not sure, but I think this (pControlRect) describes the available total space in your row template
and is meant to be used if your layout changes by user interaction in a datagrid of type FORM like
clicking a button "More options..." and you change/expand your layout dynamically.
But no matter what this means, you are setting the rect of your two fields to the same rect!
This looks like a datagrid of type TABLE.
Why not ust use a couple of columns?
Or why not just leave the "layoutcontrol" handler empty?
Best
Klaus
Re: DataGrid LayoutControl
Posted: Sat Jun 22, 2013 9:19 am
by garyth123
Hi Klaus,
Well you are quite right and that is why my text is overlaid as in the png.
It is in fact a Form.
I have two fields set up in the template. No matter what I try I cannot get them to appear as you'd expect. I get one or either of them at a time, or they overlap.
Are the items of pControlRect an x, y (of the top left corner of the field), and a horizontal width, and vertical depth?
Here is another attempt and an image of what it produces:
put the rect of field "Name" of me into theFieldRect
put item 1 to 4 of pControlRect into item 1 to 4 of theFieldRect
set the rect of field "Name" of me to theFieldRect
put the rect of field "Stadium" of me into theFieldRect
put item 4 of pControlRect into item 2 of theFieldRect
put item 3 to 4 of pControlRect into item 3 to 4 of theFieldRect
set the rect of field "Stadium" of me to theFieldRect
Re: DataGrid LayoutControl
Posted: Sat Jun 22, 2013 11:14 am
by Klaus
Hi Gary,
sorry, I still hjave no idea what you are actually trying to achieve!?
Please tell me:
1. What does your "Row template" look like.
2. How should the final layout look like.
3. If 1. is correctly setup already, do you really need the "layoutcontrol" handler?
Best
Klaus
Re: DataGrid LayoutControl
Posted: Sat Jun 22, 2013 12:04 pm
by garyth123
Hi Klaus,
I am following Academy tutorial 50 so am expecting two rows alternately coloured, but where each row is the same height.
Attached is a png of my row template, and an image of what I get if I comment out the lines in the layoutControl handler. As you can see I only get one row. I would have expected the template to take care of the layout of the two rows. I can get the other row (on its own) by fiddling with the layoutControl items to pControlRect. Or I can get the two rows overlapping, but what I want is one row reading Team name: Id and another row reading Stadium name.
It is very frustrating.
Re: DataGrid LayoutControl
Posted: Sat Jun 22, 2013 12:24 pm
by Klaus
Hi Gary,
hmm, it definitively SHOULD look like in your template WITHOUT using the "layoutcontrol" handler!
Did you un-/check "Fixed control height" for the datagrid?
Is that value "Row height" set to the heigth of the template group containing these fields?
Best
Klaus
Re: DataGrid LayoutControl
Posted: Sat Jun 22, 2013 12:44 pm
by garyth123
Hi Klaus,
Thanks that has solved the problem.
Gary
Re: DataGrid LayoutControl
Posted: Sat Jun 22, 2013 1:44 pm
by Klaus
AH, great!
