1. EuGrid Column Spacing
Is there a way to have the columns of the grid spaced 100%? For instance, I
want the first column to take up 30% of the available horizontal space and
the second column to take up the remaining 70%. I looked at doing this with
xControls, but I got stuck.
2. Re: EuGrid Column Spacing
Heya, Phil,
> 1. Get the current size of the grid using GetClientRect(grid)
> 2. The available width for columns (in pixels) is grid width minus the
> width of the row header, which can be obtained from:
> 3. Calculate 30% of the available width and set first column width:
> EGW_SetColumnProperty( grid, col1, EGW_COL_WIDTH, width )
> 4. Set second column to remaining available width
>
> If you get stuck then let me know and I will see if I can throw an
> example together.
And I just throw this into the w32HChange event of the grid itself, right?
3. Re: EuGrid Column Spacing
> > 1. Get the current size of the grid using GetClientRect(grid)
> > 2. The available width for columns (in pixels) is grid width minus the
> > width of the row header, which can be obtained from:
> > 3. Calculate 30% of the available width and set first column width:
> > EGW_SetColumnProperty( grid, col1, EGW_COL_WIDTH, width )
> > 4. Set second column to remaining available width
> >
> > If you get stuck then let me know and I will see if I can throw an
> > example together.
>
> And I just throw this into the w32HChange event of the grid itself, right?
Got it working great! Even almost perfect! (It's in the w32HResize event...)
The only problem is, when the width decreases, the columns fill the space
completely. When it increases, sometimes there is a gap between the last
column and the right edge of the grid control. This is annoying but
tolerable, and certainly not expected behavior. Any clue?
4. Re: EuGrid Column Spacing
> Hmm. Difficult to say without seeing the code. Could it be a small
> error in your pixel width calculation e.g. rounding error or something?
I don't think so, because sometimes the error is massive... especially if I
drag the window bigger real quick. I think it's a problem with Win32Lib not
reporting the proper clientRect...
Here's my procedure, though:
procedure grid1_w32HResize (integer self, integer event, sequence
params)--params is ()
sequence gridrect
atom gridwidth, col1
col1 = 0.30
gridrect = getClientRect( grid1 )
gridwidth = gridrect[3] - gridrect[1]
-- junk = message_box( sprintf("%d",{gridwidth}) , "Grid Size" , MB_OK)
col1 = floor(col1 * gridwidth)
junk = EGW_SetColumnProperty( grid1 , grid1col1 , EGW_COL_WIDTH, col1 )
junk = EGW_SetColumnProperty( grid1 , grid1col2 , EGW_COL_WIDTH,
gridwidth - col1 )
end procedure
setHandler( grid1, w32HResize, routine_id("grid1_w32HResize"))
5. Re: EuGrid Column Spacing
On Thu, 27 Mar 2003 12:05:42 -0600, C. K. Lester <cklester at yahoo.com>
wrote:
>
>> Hmm. Difficult to say without seeing the code. Could it be a small
>> error in your pixel width calculation e.g. rounding error or something?
>
> I don't think so, because sometimes the error is massive... especially if
> I
> drag the window bigger real quick. I think it's a problem with Win32Lib
> not
> reporting the proper clientRect...
Is this a bug report?
--
cheers,
Derek Parnell
6. Re: EuGrid Column Spacing
> > I think it's a problem with Win32Lib not
> > reporting the proper clientRect...
>
> Is this a bug report?
> --
>
> cheers,
> Derek Parnell
Derek, I apologize, but I don't know enough to know if it's a bug report, or
if it's due to Win32Lib, to xControls, or what!!! :)
However, if you don't mind, I'd like to send you my program as it is and let
you see it for yourself...
-ck
7. Re: EuGrid Column Spacing
On Thu, 27 Mar 2003 12:05:42 -0600, "C. K. Lester"
<cklester at yahoo.com> wrote:
>I don't think so, because sometimes the error is massive... especially =
if I
>drag the window bigger real quick.
I had a similar problem in MEditor. Guillermo Bonvehi made a
suggestion which worked well. Try adding
repaintWindow(grid1)
at the end of the w32HResize routine.
Pete
8. Re: EuGrid Column Spacing
> > I don't think so, because sometimes the error is massive... especially
if I
> > drag the window bigger real quick.
>
> I had a similar problem in MEditor. Guillermo Bonvehi made a
> suggestion which worked well. Try adding
>
> repaintWindow(grid1)
>
> at the end of the w32HResize routine.
That worked... Thanks, Pete!!
Should I have to put that repaintWindow() thingie there, or shouldn't the
event handle that?
9. Re: EuGrid Column Spacing
----- Original Message -----
From: "C. K. Lester" <cklester at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: EuGrid Column Spacing
>
> > > I don't think so, because sometimes the error is massive... especially
> if I
> > > drag the window bigger real quick.
> >
> > I had a similar problem in MEditor. Guillermo Bonvehi made a
> > suggestion which worked well. Try adding
> >
> > repaintWindow(grid1)
> >
> > at the end of the w32HResize routine.
>
> That worked... Thanks, Pete!!
>
> Should I have to put that repaintWindow() thingie there, or shouldn't the
> event handle that?
Good idea. I've added an InvalidateRect inside win32lib, after the handler
returns.
----------------
cheers,
Derek Parnell
10. Re: EuGrid Column Spacing
On Sat, 29 Mar 2003 08:41:46 +1100, Derek Parnell
<ddparnell at bigpond.com> wrote:
>> > repaintWindow(grid1)
>Good idea. I've added an InvalidateRect inside win32lib, after the =
handler
>returns.
Thanks Derek, I didn't want to moan and bitch about it too much 'cos I
know all too well you have better things to do :=3D))
I hope that means it repaints just once, not twice as that sometimes
did, and won't add unnecessary overhead othercase?
Pete