1. RE: EuGrid - Phil Russel
Jonas,
Yep - you're quite right. There is a bug in the EGW_LoadData routine
which means that the current cell is not reset to something sensible
when the dataset is replaced.
I will fix this in the next release, but in the meantime there is a
simple workaround that you can use (see code following - the fix is in
the DepClearPB_onClick routine).
HTH,
Phil
-- Beginning of code
include Win32Lib.ew
include eugrid.ew
without warning
atom dep_opt_col, dep_desc_col, rtn_code, void
---------------------------------------------------------
constant DepWin = createEx( Window, "Object Dependencies", 0, 10, 10,
550, 500, {WS_DLGFRAME, WS_SYSMENU}, {WS_EX_DLGMODALFRAME} )
constant DepGC = EGW_CreateGrid( DepWin, 10, 10, 532, 408, True)
dep_opt_col = EGW_AddColumn(DepGC, "Option", 132, EGW_LAST, EGW_EDIT, 1)
rtn_code = EGW_SetColumnProperty(DepGC, dep_opt_col, EGW_COL_MAXCHARS,
10)
dep_desc_col = EGW_AddColumn(DepGC, "Description", 350, EGW_LAST,
EGW_STATIC, 2)
constant DepClearPB = createEx( DefPushButton, "Clear", DepWin, 10, 430,
90, 30, 0, 0)
constant DepCancelPB = createEx( PushButton, "Cancel", DepWin, 110, 430,
90, 30, 0, 0)
procedure DepWin_onOpen (integer self, integer event, sequence params)
sequence dep_data
dep_data = {{"Test","Test Description"}}
rtn_code = EGW_LoadData(DepGC, dep_data, EGW_REPLACE)
end procedure
setHandler(DepWin, w32HOpen, routine_id("DepWin_onOpen"))
procedure newDependent()
sequence cell
integer row
-- Get currently selected cell
cell = EGW_GetCurrentCell(DepGC)
-- If ok to exit current cell
if not sendMessage(DepGC, EGW_CELLCHANGE, cell[1], cell[2])
and not sendMessage(DepGC, EGW_ROWCHANGE, cell[1], cell[2]) then
rtn_code = EGW_AddDataRow(DepGC, {"", ""}, EGW_LAST)
repaintWindow(DepGC)
void = EGW_ScrollToCell(DepGC, rtn_code, dep_opt_col)
repaintWindow(DepGC)
end if
end procedure
procedure DepGC_onEvent(integer self, integer event, sequence parms)
atom msg, wParam, lParam, row_count
sequence check_users, msgs, user_info, user_desc, user_grp, user,
cur_cell, tv_select
object row_data, rtn_obj
msg = parms[1]
wParam = parms[2]
lParam = parms[3]
if msg = EGW_CELLCHANGE then
cur_cell = EGW_GetCurrentCell(DepGC)
if cur_cell[1] > 0 then
void = EGW_SaveCellData(DepGC, EGW_GetCurrentCell(DepGC))
end if
elsif msg = EGW_LASTCELLTAB then
newDependent()
returnValue(True)
end if
end procedure
setHandler(DepGC, w32HEvent, routine_id("DepGC_onEvent"))
procedure DepClearPB_onClick (integer self, integer event, sequence
params)--params is ()
sequence dep_data
dep_data = {{"Test","Test Description"}}
rtn_code = EGW_LoadData(DepGC, dep_data, EGW_REPLACE)
--***START WORKAROUND Phil Russell 9/1/03
--Reset current cell to void cell
rtn_code = EGW_SetCurrentCell(DepGC, -1, -1)
--***END WORKAROUND Phil Russell 9/1/03
repaintWindow(DepGC)
end procedure
setHandler(DepClearPB , w32HClick, routine_id("DepClearPB_onClick"))
procedure DepCancelPB_onClick (integer self, integer event, sequence
params)--params is ()
closeWindow(DepWin)
end procedure
setHandler(DepCancelPB, w32HClick, routine_id("DepCancelPB_onClick"))
WinMain( DepWin,Normal )
2. RE: EuGrid - Phil Russel
Hi Jonas,
Yep - you're right again. The column sorting currently uses the
standard Euphoria sort which I believe does not handle numbers very
well. I think somebody else also mentioned this and I am planning to
use a different sort routine for the next release (probably Andy Serpa's
natural sort routine) & hopefully also allow user-specified sorts.
Thanks again for all the feedback!
Progress on the next release slowed to a crawl due to Xmas + Work but
with a bit of luck I will be able to start making some changes soon.
Regards,
Phil
PS Did you see my reply to your last post (a few weeks ago) about
loading datasets? Did the workaround work?
Jonas Temple wrote:
> Phil,
>
> Hey, got a question about EuGrid. The new sorting feature for columns
> that contain numbers is not working like I might expect.
>
> For example, run your style.exw demo. Select the "Number Format" tab.
> Click either of the column headers and select either sort order. The
> numbers do not appear in the correct order.
>
> Am I missing something in the intent of this feature?
>
> BTW, I've said it before and I'll say it again...EuGrid is an excellent
> library!
>
> Jonas
>
>
3. RE: EuGrid - Phil Russel
Phil,
The feedback is necessary as I depend VERY heavily on what you've done!
Yes, the workaround worked! Thanks again.
Jonas
Phil Russell wrote:
> Hi Jonas,
>
> Yep - you're right again. The column sorting currently uses the
> standard Euphoria sort which I believe does not handle numbers very
> well. I think somebody else also mentioned this and I am planning to
> use a different sort routine for the next release (probably Andy Serpa's
>
> natural sort routine) & hopefully also allow user-specified sorts.
> Thanks again for all the feedback!
>
> Progress on the next release slowed to a crawl due to Xmas + Work but
> with a bit of luck I will be able to start making some changes soon.
>
> Regards,
>
> Phil
>
> PS Did you see my reply to your last post (a few weeks ago) about
> loading datasets? Did the workaround work?
>
>
> Jonas Temple wrote:
> > Phil,
> >
> > Hey, got a question about EuGrid. The new sorting feature for columns
> > that contain numbers is not working like I might expect.
> >
> > For example, run your style.exw demo. Select the "Number Format" tab.
> > Click either of the column headers and select either sort order. The
> > numbers do not appear in the correct order.
> >
> > Am I missing something in the intent of this feature?
> >
> > BTW, I've said it before and I'll say it again...EuGrid is an excellent
> > library!
> >
> > Jonas
> >
> >
4. RE: EuGrid - Phil Russel
Jonas,
Your example code works fine on my home PC (win 95) using both version
1.0.1 and 1.1.0 of EuGrid. It sounds vaguely familiar as a problem that
I (thought I) fixed for 1.1.0.
The only difference that I can see in your code is that you have defined
your column ids as atoms rather than constants. Internally in EuGrid
they are held as integers, but I don't see why this should make a
difference.
Sorry I can't be more help.
Phil
Jonas Temple wrote:
> Phil,
>
> Sorry, I would have sent this to your personally but I couldn't find
> your address.
>
> Using the following example, do the following:
> 1. When the window appears type something into the user column.
> 2. Tab 3 times to go past the end of the row
> 4. What appears to happen is the current cell shifts back to cell 1 (the
>
> value you typed in the first column is highlighted) but in actuality if
> you press the up arrow key the first row is displayed. Note that what
> you typed for the first column in the first row is duplicated in the
> second row, even though an empty data row was passed on EGW_AddDataRow.
>
> Why does the grid scroll down when it doesn't need to and why is the
> text being duplicated on the second row?
>
> I noticed that the Noah example works correctly and I can't seem to find
>
> the difference.
>
> Thanks!
>
> Jonas
>
> -- Beginning of code example
> include Win32Lib.ew
> include eugrid.ew
>
> atom user_col, rtn_code, user_desc_col, user_grp_col, void
>
> constant Main = createEx( Window, "Grid Test", 0, Default, Default, 600,
>
> 450, 0, 0 )
> constant MainSB = createEx( StatusBar, "", Main, 0, 0, 0, 0, 0, 0 )
> constant UsersGC = EGW_CreateGrid( Main, 10, 10, 575, 390, True)
> user_col = EGW_AddColumn(UsersGC, "User Profile", 100, EGW_LAST,
> EGW_EDIT, 1)
> rtn_code = EGW_SetColumnProperty(UsersGC, user_col, EGW_COL_MAXCHARS,
> 10)
> user_desc_col = EGW_AddColumn(UsersGC, "Description", 300, EGW_LAST,
> EGW_STATIC, 2)
> user_grp_col = EGW_AddColumn(UsersGC, "Group Profile", 100, EGW_LAST,
> EGW_STATIC, 3)
>
> procedure newUser()
> sequence cell
> integer row
>
> -- Get currently selected cell
> cell = EGW_GetCurrentCell(UsersGC)
>
> -- If ok to exit current cell
> if not sendMessage(UsersGC, EGW_CELLCHANGE, cell[1], cell[2])
> and not sendMessage(UsersGC, EGW_ROWCHANGE, cell[1], cell[2]) then
>
> rtn_code = EGW_AddDataRow(UsersGC, {"", "", ""}, EGW_LAST)
> void = EGW_ScrollToCell(UsersGC, EGW_LAST, user_col)
>
> repaintWindow(UsersGC)
>
> end if
> end procedure
>
> procedure UsersGC_onEvent(integer self, integer event, sequence parms)
> atom msg, wParam, lParam, row_count
> sequence check_users, msgs, user_info, user_desc, user_grp, user
> object row_data
>
> msg = parms[1]
> wParam = parms[2]
> lParam = parms[3]
>
> if msg = EGW_LASTCELLTAB then
> newUser()
> returnValue(True)
> end if
> end procedure
> setHandler(UsersGC, w32HEvent, routine_id("UsersGC_onEvent"))
>
> newUser()
> WinMain(Main, Normal)
>
>
5. RE: EuGrid - Phil Russel
Phil,
What version of Win32lib are you using?
Jonas
Phil Russell wrote:
> Jonas,
>
> Your example code works fine on my home PC (win 95) using both version
> 1.0.1 and 1.1.0 of EuGrid. It sounds vaguely familiar as a problem that
>
> I (thought I) fixed for 1.1.0.
>
> The only difference that I can see in your code is that you have defined
>
> your column ids as atoms rather than constants. Internally in EuGrid
> they are held as integers, but I don't see why this should make a
> difference.
>
> Sorry I can't be more help.
>
> Phil
>
6. RE: EuGrid - Phil Russel
Phil,
Well, I tested on both win95 and win98 with the same results. However,
I did get it working right, I had to add a repaintWindow(UsersGC) call
after I added the empty row. Then it worked like I wanted.
Weird, huh?
Jonas
Phil Russell wrote:
> Jonas,
>
> Your example code works fine on my home PC (win 95) using both version
> 1.0.1 and 1.1.0 of EuGrid. It sounds vaguely familiar as a problem that
>
> I (thought I) fixed for 1.1.0.
>
> The only difference that I can see in your code is that you have defined
>
> your column ids as atoms rather than constants. Internally in EuGrid
> they are held as integers, but I don't see why this should make a
> difference.
>
> Sorry I can't be more help.
>
> Phil
7. RE: EuGrid - Phil Russel
Jonas,
Sorry not to have replied sooner (away for Xmas). Definitely weird -
but that's Windows for ya...
Haven't got access to my home PC at the moment but I think I'm still
using something like win32lib *.5.7.9 if memory serves.
Glad you fixed it anyway.
Phil
Jonas Temple wrote:
> Phil,
>
> Well, I tested on both win95 and win98 with the same results. However,
> I did get it working right, I had to add a repaintWindow(UsersGC) call
> after I added the empty row. Then it worked like I wanted.
>
> Weird, huh?
>
> Jonas
> Phil Russell wrote:
> > Jonas,
> >
> > Your example code works fine on my home PC (win 95) using both version
> > 1.0.1 and 1.1.0 of EuGrid. It sounds vaguely familiar as a problem that
> >
> >
> > I (thought I) fixed for 1.1.0.
> >
> > The only difference that I can see in your code is that you have defined
> >
> >
> > your column ids as atoms rather than constants. Internally in EuGrid
> > they are held as integers, but I don't see why this should make a
> > difference.
> >
> > Sorry I can't be more help.
> >
> > Phil
>
>
8. RE: EuGrid - Phil Russel
Hi Jonas,
I'm still here - just been a bit snowed under recently! A couple of
things are holding up the release: mostly its due to the update of the
documentation which I can't put off any more; additionally I know that
Derek is about to release a new version of win32lib and I wanted to test
EuGrid with this before releasing it. Both are (more-or-less) imminent.
Both of your suggestions seem sensible so I will add them to the list.
In the meantime you can probably simulate them by trapping the
EGW_CELLEDIT/EGW_CELLCHANGE messages in your code. You can also set a
number format for a numeric field using EGW_NUMFORMAT which will (I
think) force any data entry to e.g. 2 dps when a user exits a field. You
might want to see if that helps - I believe there is an example in the
styles.exw program.
HTH,
Phil
Jonas Temple wrote:
>
>
> posted by: Jonas Temple <jtemple at yhti.net>
>
> Phil,
>
> Haven't heard from you in a while...was hoping the new version of EuGrid
> would be out soon!
>
> Anyway, was wondering if you would consider adding a couple of features:
>
> 1. The ability to only allow upper case text in an editable cell
> 2. The ability to limit a numeric value to a certain length/decimal
> positions. I.E. - I only want the user to enter a number up to 999.99
> no more than two decimal places.
>
> Thanks!
>
> Jonas