1. Grid Control: how properly add data to new row?

Phil,

I'm trying out your Grid Control, however, I am having a problem filling
things in the grid properly, in that when I add a new row, the last column
doesn't show
anything except the same thing that's in the first column.

Maybe you or someone who has used the GridControl can see what I'm doing
wrong?

--<code snippet follows:>

-- grid column layout is:  file name, checkbox1, checkbox2, directory name
  newRow = {fName,"","",dirName }
-- dirName & fName DO have respective proper content, I checked

--global constant EmptyGridRow = {"", 2, "", "", 0, True}  -- example from a
demo
                                                                            
        --for a different layout

  -- Add new row to grid:
  row = EGW_AddDataRow(aGrid, newRow, EGW_LAST)
  void = EGW_SetDataRowFlag(aGrid, row, EGW_ROW_NEW, True)

-- also fails to include dirName if I comment out the above "void" function

Dan Moyer

new topic     » topic index » view message » categorize

2. Re: Grid Control: how properly add data to new row?

Jonas,

Ok, I'll try the repaintWindow, because I had noticed a minor problem with
the row not showing up until I moved the horiz scroll; however, *visibly*
displaying the whole new row is *not* the problem I'm having.

My problem is *what* gets put into the last column of a newly added row;  it
puts the *same* data into my last column as was put into my first column,
even if I tell it to put exact text instead of whatever's in a variable.

Dan Moyer

--<problem demo code follows>

--  code generated by Win32Lib IDE v0.14.2

include Win32lib.ew
without warning

----------------------------------------------------------------------------
----
--  Window Window1
constant Window1 = createEx( Window, "Grid Control with CheckBoxes", 0,
Default, Default, 600, 300, 0, 0 )
constant PushButton2 = createEx( PushButton, "Select File", Window1, 484,
20, 88, 28, 0, 0 )
---------------------------------------------------------
----------------------------------------------------------------------------
----
include eugrid.ew
atom void

integer aGrid, colFileName, colCB1, colCB2, colFileDir

-- Create grid, create parms=(parent, x, y, width, height, show_window)
aGrid = EGW_CreateGrid( Window1, 10, 15, 450, 200, True )

-- no row header
void = EGW_SetGridProperty( aGrid, EGW_ROW_HEADER_WIDTH, 0)


-- Filename column - static text, left-aligned by default
colFileName  = EGW_AddColumn( aGrid, "FileName", 200, EGW_LAST, EGW_STATIC,
1 )
void = EGW_SetColumnProperty(aGrid, colFileName, EGW_COL_ALIGN, EGW_CENTER)
--void   = EGW_SetColumnProperty( aGrid, colFileName, EGW_COL_WIDTH, 75 )

-- checkbox columns:
colCB1 = EGW_AddColumn(aGrid, "Action1", 100, EGW_LAST, EGW_CHECKBOX, 2 )
void = EGW_SetColumnProperty(aGrid, colCB1, EGW_COL_ALIGN, EGW_CENTER)
colCB2 = EGW_AddColumn(aGrid, "Action2", 100, EGW_LAST, EGW_CHECKBOX, 3 )
void = EGW_SetColumnProperty(aGrid, colCB2, EGW_COL_ALIGN, EGW_CENTER)

-- file directory column:
colFileDir  = EGW_AddColumn( aGrid, "FileDirectory", 400, EGW_LAST,
EGW_STATIC, 1 )
void = EGW_SetColumnProperty(aGrid, colFileDir, EGW_COL_ALIGN, EGW_CENTER)
----------------------------------------------------------------------------
----
procedure PushButton2_onClick (integer self, integer event, sequence
params)--params is ()
seq fName, dirName, fullPathName, temp
seq newRow
int row, posBS  -- posBS is position of back-slash in file name

temp = {}

  -- get a file name
  fName = getOpenFileName( Window1, current_dir() & "\\", "" )
  -- entered a file name?
  if length( fName ) = 0 then
     return
  end if

  -- separate filename from dirName:
  if find('\\',fName) then -- found back-slash
     -- work from end, remove chars after last back-slash:
     for n = length(fName) to 1 by -1do
      if not equal('\\',fName[n]) then
         temp = prepend(temp,fName[n])
       else
         posBS = n
        exit
      end if
     end for

     fullPathName = fName
     dirName = fName[1..posBS -1]
     fName = temp
   else
     dirName = ""
   end if

  newRow = {fName,"","",dirName }

-- example relating to adding new row:
--global constant EmptyGridRow = {"", 2, "", "", 0, True}

  -- Add new row to grid:
  row = EGW_AddDataRow(aGrid, newRow, EGW_LAST)
  void = EGW_SetDataRowFlag(aGrid, row, EGW_ROW_NEW, True)

  -- Go to it?
--  void = EGW_ScrollToCell(aGrid, EGW_LAST, colFileName)


end procedure
setHandler( PushButton2, w32HClick, routine_id("PushButton2_onClick"))


WinMain( Window1,Normal )



----- Original Message -----
From: "Jonas Temple" <jktemple at yhti.net>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, February 09, 2003 7:35 PM
Subject: RE: Grid Control: how properly add data to new row?


>
> Dan,
>
> Phil is aware of a couple of issues that sound like it might relate to
> your problem and I think he's working on a fix for this.
>
> In the meantime, I will try and help, if possible.  Could you send a
> more complete example of the code you're having a problem with?
>
> Also, here's one thing you might want to try.  I don't have the exact
> code in front of me but you might try using the repaintWindow() function
> after adding the new grid row.  This might cause the new row to display
> properly.
>
> Jonas
> Dan Moyer wrote:
> > Phil,
> >
> > I'm trying out your Grid Control, however, I am having a problem filling
> > things in the grid properly, in that when I add a new row, the last
> > column
> > doesn't show
> > anything except the same thing that's in the first column.
> >
> > Maybe you or someone who has used the GridControl can see what I'm doing
> > wrong?
> >
> > --<code snippet follows:>
> >
> > -- grid column layout is:  file name, checkbox1, checkbox2, directory
> > name
> >   newRow = {fName,"","",dirName }
> > -- dirName & fName DO have respective proper content, I checked
> >
> > --global constant EmptyGridRow = {"", 2, "", "", 0, True}  -- example
> > from a
> > demo
> >
> >         --for a different layout
> >
> >   -- Add new row to grid:
> >   row = EGW_AddDataRow(aGrid, newRow, EGW_LAST)
> >   void = EGW_SetDataRowFlag(aGrid, row, EGW_ROW_NEW, True)
> >
> > -- also fails to include dirName if I comment out the above "void"
> > function
> >
> > Dan Moyer
> >
> >
>
>
> TOPICA - Start your own email discussion group. FREE!
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: Grid Control: how properly add data to new row?

Jonas, Phil,

Sigh, never mind, I found my error, same kind of thing for when I had
checkboxes in both columns responding together; in this case, I left the
last parameter in creating the last column the *same* as for the first
column:

> -- Filename column - static text, left-aligned by default
> colFileName  = EGW_AddColumn( aGrid, "FileName", 200, EGW_LAST,
> EGW_STATIC, 1 )

> -- file directory column:
> colFileDir  = EGW_AddColumn( aGrid, "FileDirectory", 400, EGW_LAST,
> EGW_STATIC, 1 )

Changing that last "1" for the file directory column to a "4" fixed my
problem.

Dan

----- Original Message -----
From: "Dan Moyer" <DANIELMOYER at prodigy.net>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, February 09, 2003 8:06 PM
Subject: Re: Grid Control: how properly add data to new row?


>
> Jonas,
>
> Ok, I'll try the repaintWindow, because I had noticed a minor problem with
> the row not showing up until I moved the horiz scroll; however, *visibly*
> displaying the whole new row is *not* the problem I'm having.
>
> My problem is *what* gets put into the last column of a newly added row;
it
> puts the *same* data into my last column as was put into my first column,
> even if I tell it to put exact text instead of whatever's in a variable.
>
> Dan Moyer
>
> --<problem demo code follows>
>
> --  code generated by Win32Lib IDE v0.14.2
>
> include Win32lib.ew
> without warning
>
> --------------------------------------------------------------------------
--
> ----
> --  Window Window1
> constant Window1 = createEx( Window, "Grid Control with CheckBoxes", 0,
> Default, Default, 600, 300, 0, 0 )
> constant PushButton2 = createEx( PushButton, "Select File", Window1, 484,
> 20, 88, 28, 0, 0 )
> ---------------------------------------------------------
> --------------------------------------------------------------------------
--
> ----
> include eugrid.ew
> atom void
>
> integer aGrid, colFileName, colCB1, colCB2, colFileDir
>
> -- Create grid, create parms=(parent, x, y, width, height, show_window)
> aGrid = EGW_CreateGrid( Window1, 10, 15, 450, 200, True )
>
> -- no row header
> void = EGW_SetGridProperty( aGrid, EGW_ROW_HEADER_WIDTH, 0)
>
>
> -- Filename column - static text, left-aligned by default
> colFileName  = EGW_AddColumn( aGrid, "FileName", 200, EGW_LAST,
EGW_STATIC,
> 1 )
> void = EGW_SetColumnProperty(aGrid, colFileName, EGW_COL_ALIGN,
EGW_CENTER)
> --void   = EGW_SetColumnProperty( aGrid, colFileName, EGW_COL_WIDTH, 75 )
>
> -- checkbox columns:
> colCB1 = EGW_AddColumn(aGrid, "Action1", 100, EGW_LAST, EGW_CHECKBOX, 2 )
> void = EGW_SetColumnProperty(aGrid, colCB1, EGW_COL_ALIGN, EGW_CENTER)
> colCB2 = EGW_AddColumn(aGrid, "Action2", 100, EGW_LAST, EGW_CHECKBOX, 3 )
> void = EGW_SetColumnProperty(aGrid, colCB2, EGW_COL_ALIGN, EGW_CENTER)
>
> -- file directory column:
> colFileDir  = EGW_AddColumn( aGrid, "FileDirectory", 400, EGW_LAST,
> EGW_STATIC, 1 )
> void = EGW_SetColumnProperty(aGrid, colFileDir, EGW_COL_ALIGN, EGW_CENTER)
> --------------------------------------------------------------------------
--
> ----
> procedure PushButton2_onClick (integer self, integer event, sequence
> params)--params is ()
> seq fName, dirName, fullPathName, temp
> seq newRow
> int row, posBS  -- posBS is position of back-slash in file name
>
> temp = {}
>
>   -- get a file name
>   fName = getOpenFileName( Window1, current_dir() & "\\", "" )
>   -- entered a file name?
>   if length( fName ) = 0 then
>      return
>   end if
>
>   -- separate filename from dirName:
>   if find('\\',fName) then -- found back-slash
>      -- work from end, remove chars after last back-slash:
>      for n = length(fName) to 1 by -1do
>       if not equal('\\',fName[n]) then
>          temp = prepend(temp,fName[n])
>        else
>          posBS = n
>         exit
>       end if
>      end for
>
>      fullPathName = fName
>      dirName = fName[1..posBS -1]
>      fName = temp
>    else
>      dirName = ""
>    end if
>
>   newRow = {fName,"","",dirName }
>
> -- example relating to adding new row:
> --global constant EmptyGridRow = {"", 2, "", "", 0, True}
>
>   -- Add new row to grid:
>   row = EGW_AddDataRow(aGrid, newRow, EGW_LAST)
>   void = EGW_SetDataRowFlag(aGrid, row, EGW_ROW_NEW, True)
>
>   -- Go to it?
> --  void = EGW_ScrollToCell(aGrid, EGW_LAST, colFileName)
>
>
> end procedure
> setHandler( PushButton2, w32HClick, routine_id("PushButton2_onClick"))
>
>
> WinMain( Window1,Normal )
>
>
> ----- Original Message -----
> From: "Jonas Temple" <jktemple at yhti.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Sunday, February 09, 2003 7:35 PM
> Subject: RE: Grid Control: how properly add data to new row?
>
>
> > Dan,
> >
> > Phil is aware of a couple of issues that sound like it might relate to
> > your problem and I think he's working on a fix for this.
> >
> > In the meantime, I will try and help, if possible.  Could you send a
> > more complete example of the code you're having a problem with?
> >
> > Also, here's one thing you might want to try.  I don't have the exact
> > code in front of me but you might try using the repaintWindow() function
> > after adding the new grid row.  This might cause the new row to display
> > properly.
> >
> > Jonas
> > Dan Moyer wrote:
> > > Phil,
> > >
> > > I'm trying out your Grid Control, however, I am having a problem
filling
> > > things in the grid properly, in that when I add a new row, the last
> > > column
> > > doesn't show
> > > anything except the same thing that's in the first column.
> > >
> > > Maybe you or someone who has used the GridControl can see what I'm
doing
> > > wrong?
> > >
> > > --<code snippet follows:>
> > >
> > > -- grid column layout is:  file name, checkbox1, checkbox2, directory
> > > name
> > >   newRow = {fName,"","",dirName }
> > > -- dirName & fName DO have respective proper content, I checked
> > >
> > > --global constant EmptyGridRow = {"", 2, "", "", 0, True}  -- example
> > > from a
> > > demo
> > >
> > >         --for a different layout
> > >
> > >   -- Add new row to grid:
> > >   row = EGW_AddDataRow(aGrid, newRow, EGW_LAST)
> > >   void = EGW_SetDataRowFlag(aGrid, row, EGW_ROW_NEW, True)
> > >
> > > -- also fails to include dirName if I comment out the above "void"
> > > function
> > >
> > > Dan Moyer
> > >
> > >
> > TOPICA - Start your own email discussion group. FREE!
> >
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu