[wxperl-users] wxPerl 0.21 prerelease

Hello,
http://www.barbon.org/wxperl

I will try to upload the Mac DM=
G ASAP.
The Windows Unicode version is compiled with
Unicows.

Please=
 try and report problems.

Thanks!
Mattia
=0A=0A=0A=0A_______________=
_____________________________________________=0ALibero ADSL: navighi grat=
is a 1.2 Mega, senza canone e costi di attivazione. =0AAbbonati subito su=
 http://www.libero.it =0A


0 mattia 11/8/2004 9:28:59 AM
Pulled down and got this failure on make (Linux, wxGTK2-2.5):

/usr/bin/perl /usr/lib/perl5/5.8.1/ExtUtils/xsubpp  -noprototypes 
-nolinenumbers  -typemap /usr/lib/perl5/5.8.1/ExtUtils/typemap -typemap 
.../../typemap -typemap typemap  FS.xs > FS.xsc && mv FS.xsc FS.c
g++ -c  -I. -I../.. -I/usr/local/lib/wx/include/gtk2-2.5 
-I/usr/local/include   -O2 -g -pipe -march=i386 -mcpu=i686   
-DVERSION="0.01" -DXS_VERSION="0.01" -fPIC 
"-I/usr/lib/perl5/5.8.1/i386-linux-thread-multi/CORE"  -DWXPL_EXT 
-DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES  FS.c
In file included from cpp/fshandler.h:17,
                 from FS.c:123:
.../../cpp/streams.h:37: error: `wxFileOffset' was not declared in this scope
.../../cpp/streams.h:37: error: syntax error before `,' token
.../../cpp/streams.h:38: error: syntax error before `)' token
.../../cpp/streams.h:60: error: `wxFileOffset' was not declared in this scope
.../../cpp/streams.h:60: error: syntax error before `,' token
.../../cpp/streams.h:61: error: syntax error before `)' token
make[2]: *** [FS.o] Error 1
make[2]: Leaving directory `/home/mike/downloads/Wx-0.21/ext/filesys'
make[1]: *** [subdirs] Error 2
make[1]: Leaving directory `/home/mike/downloads/Wx-0.21/ext'
make: *** [subdirs] Error 2



mattia.barbon@libero.it wrote:

>  Hello,
>http://www.barbon.org/wxperl
>
>I will try to upload the Mac DMG ASAP.
>The Windows Unicode version is compiled with
>Unicows.
>
>Please try and report problems.
>
>Thanks!
>Mattia
>
>
>
>
>____________________________________________________________
>Libero ADSL: navighi gratis a 1.2 Mega, senza canone e costi di attivazione. 
>Abbonati subito su http://www.libero.it 
>
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by:
>Sybase ASE Linux Express Edition - download now for FREE
>LinuxWorld Reader's Choice Award Winner for best database on Linux.
>http://ads.osdn.com/?ad_idU88&alloc_id065&op=click
>_______________________________________________
>wxperl-users mailing list
>wxperl-users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/wxperl-users
>  
>

0 MikeSchroeder 11/8/2004 4:11:09 PM
On Mon, 08 Nov 2004 09:06:05 -0700 Mike Schroeder  wrote:

> Pulled down and got this failure on make (Linux, wxGTK2-2.5):
> 
> /usr/bin/perl /usr/lib/perl5/5.8.1/ExtUtils/xsubpp  -noprototypes 
> -nolinenumbers  -typemap /usr/lib/perl5/5.8.1/ExtUtils/typemap -typemap 
> ../../typemap -typemap typemap  FS.xs > FS.xsc && mv FS.xsc FS.c
> g++ -c  -I. -I../.. -I/usr/local/lib/wx/include/gtk2-2.5 
> -I/usr/local/include   -O2 -g -pipe -march=i386 -mcpu=i686   
> -DVERSION="0.01" -DXS_VERSION="0.01" -fPIC 
> "-I/usr/lib/perl5/5.8.1/i386-linux-thread-multi/CORE"  -DWXPL_EXT 
> -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES  FS.c
> In file included from cpp/fshandler.h:17,
>                  from FS.c:123:
> ../../cpp/streams.h:37: error: `wxFileOffset' was not declared in this scope
> ../../cpp/streams.h:37: error: syntax error before `,' token
> ../../cpp/streams.h:38: error: syntax error before `)' token
> ../../cpp/streams.h:60: error: `wxFileOffset' was not declared in this scope
> ../../cpp/streams.h:60: error: syntax error before `,' token
> ../../cpp/streams.h:61: error: syntax error before `)' token
> make[2]: *** [FS.o] Error 1
> make[2]: Leaving directory `/home/mike/downloads/Wx-0.21/ext/filesys'
> make[1]: *** [subdirs] Error 2
> make[1]: Leaving directory `/home/mike/downloads/Wx-0.21/ext'
> make: *** [subdirs] Error 2

  I appreciate the report. However I suspect this is not
wxWidgets 2.5.3 [1]. As a policy (and a measure to keep sanity...)
I do not guarantee that wxPerl releases will work against
wxWidgets developement CVS and wxWidgets old developement releases [2].

  If this indeed is wxWidgets 2.5.3, then I am puzzled...

Thanks!
Mattia

[1] but rather wxWidgets 2.5.2, or a CVS snapshot
[2] I might reconsider this point if and only if only
    a minor change is required


0 mattia 11/8/2004 10:25:22 PM
My bad -- it was wxWidgets 2.5.2 - I just built against 2.5.3 without 
problems.  Sorry -- didn't see that Wx-0.21 was just for wxWidgets 2.5.3 
-- now running wxGTK2.5.3 with wxPerl 0.21.


Most things seem to be working, but I did stumble onto this:  When going 
in demo.pl to the NotebookSizer, I get this:

[mike@mbs demo]$ perl demo.pl
Can't locate object method "new" via package "Wx::NotebookSizer" at 
/home/mike/downloads/Wx-0.21/demo/wxNotebookSizer.pm line 64.
free(): invalid pointer 0xbfffecb0!

I notice that the Changes file for wxGTK 2.5.3 says:

- wxNotebookSizer and wxBookCtrlSizer are now deprecated -- they are no 
longer
  needed, you can treat wxNotebook as any other control and put it directly
  into the sizer that was wxNotebookSizer's parent sizer in old code.

Since we use wxGlade to generate a lot of our code, I'll bring it up on 
their list, however it might be worth patching the demo for this change:

64c64
<   #my $nbsizer = Wx::NotebookSizer->new( $notebook );
---
 >   my $nbsizer = Wx::NotebookSizer->new( $notebook );
95c95
<   $top_sizer->Add( $notebook, 1, wxGROW );
---
 >   $top_sizer->Add( $nbsizer, 1, wxGROW );




Also, with the Theads demo, I noticed this (we're not using threads so 
no impact on us):

[mike@mbs demo]$ perl demo.pl
thread failed to start: Error while autoloading 'Wx::Usleep' at 
/home/mike/downloads/Wx-0.21/demo/wxThread.pm line 103
thread failed to start: Error while autoloading 'Wx::Usleep' at 
/home/mike/downloads/Wx-0.21/demo/wxThread.pm line 103
        (in cleanup) Can't locate object method "DESTROY" via package 
"ThreadsDemoWin" at /home/mike/downloads/Wx-0.21/demo/wxThread.pm line 91.
        (in cleanup) Can't locate object method "DESTROY" via package 
"ThreadsDemoWin" at /home/mike/downloads/Wx-0.21/demo/wxThread.pm line 
91 during global destruction.
Attempt to free temp prematurely: SV 0x8bb5cd4 during global destruction.
Scalars leaked: 2
        (in cleanup) Can't locate object method "DESTROY" via package 
"ThreadsDemoWin" at /home/mike/downloads/Wx-0.21/demo/wxThread.pm line 
91 during global destruction.
Attempt to free temp prematurely: SV 0x87c375c during global destruction.
Scalars leaked: 2
Segmentation fault


Hope this helps...


Mattia Barbon wrote:

>  I appreciate the report. However I suspect this is not
>wxWidgets 2.5.3 [1]. As a policy (and a measure to keep sanity...)
>I do not guarantee that wxPerl releases will work against
>wxWidgets developement CVS and wxWidgets old developement releases [2].
>
>  If this indeed is wxWidgets 2.5.3, then I am puzzled...
>
>Thanks!
>Mattia
>
>[1] but rather wxWidgets 2.5.2, or a CVS snapshot
>[2] I might reconsider this point if and only if only
>    a minor change is required
>  
>

0 MikeSchroeder 11/8/2004 11:39:21 PM
--- Mike Schroeder  wrote:

> My bad -- it was wxWidgets 2.5.2 - I just built against 2.5.3 without 
> problems.  Sorry -- didn't see that Wx-0.21 was just for wxWidgets 2.5.3 
> -- now running wxGTK2.5.3 with wxPerl 0.21.
> 
> 
> Most things seem to be working, but I did stumble onto this:  When going 
> in demo.pl to the NotebookSizer, I get this:
> 
> [mike@mbs demo]$ perl demo.pl
> Can't locate object method "new" via package "Wx::NotebookSizer" at 
> /home/mike/downloads/Wx-0.21/demo/wxNotebookSizer.pm line 64.
> free(): invalid pointer 0xbfffecb0!
> 
> I notice that the Changes file for wxGTK 2.5.3 says:
> 
> - wxNotebookSizer and wxBookCtrlSizer are now deprecated -- they are no 
> longer
>   needed, you can treat wxNotebook as any other control and put it directly
>   into the sizer that was wxNotebookSizer's parent sizer in old code.

****?!
Deprecated does not mean remove immediately dammit.
That should still work.




		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


0 crazyinsomniac 11/9/2004 5:28:00 PM
On Mon, 08 Nov 2004 16:35:19 -0700 Mike Schroeder  wrote:

> My bad -- it was wxWidgets 2.5.2 - I just built against 2.5.3 without 
> problems.  Sorry -- didn't see that Wx-0.21 was just for wxWidgets 2.5.3 
> -- now running wxGTK2.5.3 with wxPerl 0.21.
  
  Well, you are not supposed to read my mind after all ;-)

> Most things seem to be working, but I did stumble onto this:  When going 
> in demo.pl to the NotebookSizer, I get this:
> 
> [mike@mbs demo]$ perl demo.pl
> Can't locate object method "new" via package "Wx::NotebookSizer" at 
> /home/mike/downloads/Wx-0.21/demo/wxNotebookSizer.pm line 64.
> free(): invalid pointer 0xbfffecb0!
> 
> I notice that the Changes file for wxGTK 2.5.3 says:
> 
> - wxNotebookSizer and wxBookCtrlSizer are now deprecated -- they are no 
> longer
>   needed, you can treat wxNotebook as any other control and put it directly
>   into the sizer that was wxNotebookSizer's parent sizer in old code.
> 
> Since we use wxGlade to generate a lot of our code, I'll bring it up on 
> their list, however it might be worth patching the demo for this change:
> 
> 64c64
> <   #my $nbsizer = Wx::NotebookSizer->new( $notebook );
> ---
>  >   my $nbsizer = Wx::NotebookSizer->new( $notebook );
> 95c95
> <   $top_sizer->Add( $notebook, 1, wxGROW );
> ---
>  >   $top_sizer->Add( $nbsizer, 1, wxGROW );
 
  Yes. I will  also reconsider such an abrupt removal. 
OTOH I think it is unnecessary in wxWidgets 2.4.2, too.
I will check on that.
 
> Also, with the Theads demo, I noticed this (we're not using threads so 
> no impact on us):
> 
> [mike@mbs demo]$ perl demo.pl
> thread failed to start: Error while autoloading 'Wx::Usleep' at 
> /home/mike/downloads/Wx-0.21/demo/wxThread.pm line 103
> thread failed to start: Error while autoloading 'Wx::Usleep' at 
> /home/mike/downloads/Wx-0.21/demo/wxThread.pm line 103
>         (in cleanup) Can't locate object method "DESTROY" via package 
> "ThreadsDemoWin" at /home/mike/downloads/Wx-0.21/demo/wxThread.pm line 91.
>         (in cleanup) Can't locate object method "DESTROY" via package 
> "ThreadsDemoWin" at /home/mike/downloads/Wx-0.21/demo/wxThread.pm line 
> 91 during global destruction.
> Attempt to free temp prematurely: SV 0x8bb5cd4 during global destruction.
> Scalars leaked: 2
>         (in cleanup) Can't locate object method "DESTROY" via package 
> "ThreadsDemoWin" at /home/mike/downloads/Wx-0.21/demo/wxThread.pm line 
> 91 during global destruction.
> Attempt to free temp prematurely: SV 0x87c375c during global destruction.
> Scalars leaked: 2
> Segmentation fault

  Likewise.

> Hope this helps...

  Yes, a lot!

Thanks!
Mattia


0 mattia 11/9/2004 8:52:05 PM
Hi Mattia,

I have been using the Wx::Grid module and I have come across a method that
has not been wrapped.

The method is GetSelectedCells and returns wxGridCellCoordsArray which I
assume is where the problem lays since this is complex data type being an
array of the class wxGridCellCoords.

I do not know where to begin to wrap this myself, but perhaps with a few
basic pointers I will give it a go. I assume we would return an array of
elements where each element is a two integer array (row, col) ??? Or would
we define an explicit class like Wx::Point??

Thanks for any help.

Regards
Mark



0 mark 11/16/2004 11:02:07 AM
On Tue, 16 Nov 2004 13:02:02 +0200 Mark Wardell  wrote:

  Hello,

> I have been using the Wx::Grid module and I have come across a method that
> has not been wrapped.
> 
> The method is GetSelectedCells and returns wxGridCellCoordsArray which I
> assume is where the problem lays since this is complex data type being an
> array of the class wxGridCellCoords.

  While arrays are nontrivial, they aren't that difficult neither.

> I do not know where to begin to wrap this myself, but perhaps with a few
> basic pointers I will give it a go. I assume we would return an array of
> elements where each element is a two integer array (row, col) ??? Or would
> we define an explicit class like Wx::Point??

  The basic structure is like the one of
wxWindow::GetChildren(Window.xs) and wxGrid::GetSelectedCols(Grid.xs).
For creating the wxGridCellCoords use wxPli_non_object_2_sv.

HTH
Mattia


0 mattia 11/16/2004 9:05:03 PM
thanks mattia,

0.21 works fine on win and the bug i reportet seem to gone away, still 
on my wishlist would be that more wxstc lexer are wrapped and a internal 
constant that tells me which version of scintilla is in, but i can wait, 
because now i can do the most cruical feater that have been missed in my 
wxApp good work.

herbert
proton-ce.sf.net

0 deirdre_skye 11/17/2004 4:00:03 AM
Mattia,

0.21 works fine for me too. I haven't seen anything bad until now.

Thanks a million for your great work!
Olivier.


0 olivier 11/17/2004 10:00:01 AM
Hi Mattia,

I have spent quite a bit of time on this but being my first major attempt at
this, I confess it is quite a struggle. What I managed so far is below, it
compiles but throws an exception at runtime. I am sure there are several
problems.

void
wxGrid::GetSelectedCells()
  PPCODE:
    int i;
    int n;
    wxGridCellCoordsArray coordsArray = THIS->GetSelectedCells();
    n = (int) sizeof(wxGridCellCoordsArray) / (int)
sizeof(wxGridCellCoords);

    for( i = 0; i < n; ++i )
    {
	PUSHs( wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
		new wxGridCellCoords( coordsArray[i] ),
		"Wx::GridCellCoords" ) );
    }

Can you give me some feedback / pointers? I am sure with a little assistance
at the start I will be of more help in time.

Many thanks,
Mark

> -----Original Message-----
> From: Mattia Barbon [mailto:mattia.barbon@libero.it] 
> Sent: 16 November 2004 11:05 PM
> To: Mark Wardell
> Cc: 'wxPerl users ML'
> Subject: Re: [wxperl-users] Wx::Grid missing GetSelectedCells
> 
> On Tue, 16 Nov 2004 13:02:02 +0200 Mark Wardell 
>  wrote:
> 
>   Hello,
> 
> > I have been using the Wx::Grid module and I have come 
> across a method 
> > that has not been wrapped.
> > 
> > The method is GetSelectedCells and returns 
> wxGridCellCoordsArray which 
> > I assume is where the problem lays since this is complex data type 
> > being an array of the class wxGridCellCoords.
> 
>   While arrays are nontrivial, they aren't that difficult neither.
> 
> > I do not know where to begin to wrap this myself, but 
> perhaps with a 
> > few basic pointers I will give it a go. I assume we would return an 
> > array of elements where each element is a two integer array 
> (row, col) 
> > ??? Or would we define an explicit class like Wx::Point??
> 
>   The basic structure is like the one of
> wxWindow::GetChildren(Window.xs) and wxGrid::GetSelectedCols(Grid.xs).
> For creating the wxGridCellCoords use wxPli_non_object_2_sv.
> 
> HTH
> Mattia
> 
> 



0 mark 11/18/2004 10:52:01 AM
On Thu, 18 Nov 2004 12:51:17 +0200 Mark Wardell  wrote:

  Hello,
sorry for the delay in getting back to you!

> I have spent quite a bit of time on this but being my first major attempt at
> this, I confess it is quite a struggle. What I managed so far is below, it
> compiles but throws an exception at runtime. I am sure there are several
> problems.
> 
> void
> wxGrid::GetSelectedCells()
>   PPCODE:
>     int i;
>     int n;
>     wxGridCellCoordsArray coordsArray = THIS->GetSelectedCells();
>     n = (int) sizeof(wxGridCellCoordsArray) / (int)
> sizeof(wxGridCellCoords);
> 
>     for( i = 0; i < n; ++i )
>     {
> 	PUSHs( wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
> 		new wxGridCellCoords( coordsArray[i] ),
> 		"Wx::GridCellCoords" ) );
>     }

void
wxGrid::GetSelectedCells()
  PPCODE:
    wxGridCellCoordsArray selection = THIS->GetSelectedCells();
    EXTEND( SP, (IV) selection.GetCount() );

    for( size_t i = 0; i < selection.GetCount(); ++i )
      PUSHs( wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
             new wxGridCellCoords( selection[i] ),
             "Wx::GridCellCoords" ) );

  I must admit that it was more difficult
than I initially thought of.

Regards
Mattia

0 mattia 11/23/2004 9:42:03 PM
The code compiled correctly and returns a Wx::GridCellCoordsArray in a
EVT_GRID_RANGE_SELECT handler "sometimes". I found that if I select cells
with the Control key pressed they the event seems to fire all the time as
expected but if I drag the mouse over several cells then the event does not
fire. Actually the event fires but the method returns undef.

I am not sure if this is a dev error (me :-) or a wxWidgets issue or a
wxPerl issue, as I have not had time to test thoroughly. I will post more
info as I test it more.

> -----Original Message-----
> From: wxperl-users-admin@lists.sourceforge.net 
> [mailto:wxperl-users-admin@lists.sourceforge.net] On Behalf 
> Of Mattia Barbon
> Sent: 23 November 2004 11:42 PM
> To: Mark Wardell
> Cc: 'wxPerl users ML'
> Subject: Re[2]: [wxperl-users] Wx::Grid missing GetSelectedCells
> 
> On Thu, 18 Nov 2004 12:51:17 +0200 Mark Wardell 
>  wrote:
> 
>   Hello,
> sorry for the delay in getting back to you!
> 
> > I have spent quite a bit of time on this but being my first major 
> > attempt at this, I confess it is quite a struggle. What I 
> managed so 
> > far is below, it compiles but throws an exception at runtime. I am 
> > sure there are several problems.
> > 
> > void
> > wxGrid::GetSelectedCells()
> >   PPCODE:
> >     int i;
> >     int n;
> >     wxGridCellCoordsArray coordsArray = THIS->GetSelectedCells();
> >     n = (int) sizeof(wxGridCellCoordsArray) / (int) 
> > sizeof(wxGridCellCoords);
> > 
> >     for( i = 0; i < n; ++i )
> >     {
> > 	PUSHs( wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
> > 		new wxGridCellCoords( coordsArray[i] ),
> > 		"Wx::GridCellCoords" ) );
> >     }
> 
> void
> wxGrid::GetSelectedCells()
>   PPCODE:
>     wxGridCellCoordsArray selection = THIS->GetSelectedCells();
>     EXTEND( SP, (IV) selection.GetCount() );
> 
>     for( size_t i = 0; i < selection.GetCount(); ++i )
>       PUSHs( wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
>              new wxGridCellCoords( selection[i] ),
>              "Wx::GridCellCoords" ) );
> 
>   I must admit that it was more difficult than I initially thought of.
> 
> Regards
> Mattia
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide Read honest & 
> candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now. 
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> wxperl-users mailing list
> wxperl-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wxperl-users
> 



0 mark 11/24/2004 1:27:07 PM
On Wed, 24 Nov 2004 15:16:16 +0200 Mark Wardell  wrote:

> The code compiled correctly and returns a Wx::GridCellCoordsArray in a
> EVT_GRID_RANGE_SELECT handler "sometimes". I found that if I select cells
> with the Control key pressed they the event seems to fire all the time as
> expected but if I drag the mouse over several cells then the event does not
> fire. Actually the event fires but the method returns undef.
> 
> I am not sure if this is a dev error (me :-) or a wxWidgets issue or a
> wxPerl issue, as I have not had time to test thoroughly. I will post more
> info as I test it more.

  I think it depends on the wxGrid API; check wx-dev and wx-users
archives. I remember some discussion about this.

Regards
Mattia


0 mattia 11/25/2004 8:34:04 PM
Hi Mattia,

I have now revisited this and tested more thoroughly, the last time I worked
on this I was experiencing problems with the firing of the events so I never
got to test what the method actually returned.

Now I am not looking at the events at all but Wx::Grid::GetSelectedCells
does not seem to be returning the array as expected. GetSelectedRows and
GetSelectedCols work as expected but this returns nothing.

Any assistance would be appreciated. I will add some code to the sample
tomorrow to demonstrate the selection of rows, cols and cells to highlight
the problem.

Thanks
Mark

-----Original Message-----
From: wxperl-users-admin@lists.sourceforge.net
[mailto:wxperl-users-admin@lists.sourceforge.net] On Behalf Of Mattia Barbon
Sent: 23 November 2004 11:42 PM
To: Mark Wardell
Cc: 'wxPerl users ML'
Subject: Re[2]: [wxperl-users] Wx::Grid missing GetSelectedCells

On Thu, 18 Nov 2004 12:51:17 +0200 Mark Wardell  wrote:

  Hello,
sorry for the delay in getting back to you!

> I have spent quite a bit of time on this but being my first major 
> attempt at this, I confess it is quite a struggle. What I managed so 
> far is below, it compiles but throws an exception at runtime. I am 
> sure there are several problems.
> 
> void
> wxGrid::GetSelectedCells()
>   PPCODE:
>     int i;
>     int n;
>     wxGridCellCoordsArray coordsArray = THIS->GetSelectedCells();
>     n = (int) sizeof(wxGridCellCoordsArray) / (int) 
> sizeof(wxGridCellCoords);
> 
>     for( i = 0; i < n; ++i )
>     {
> 	PUSHs( wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
> 		new wxGridCellCoords( coordsArray[i] ),
> 		"Wx::GridCellCoords" ) );
>     }

void
wxGrid::GetSelectedCells()
  PPCODE:
    wxGridCellCoordsArray selection = THIS->GetSelectedCells();
    EXTEND( SP, (IV) selection.GetCount() );

    for( size_t i = 0; i < selection.GetCount(); ++i )
      PUSHs( wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
             new wxGridCellCoords( selection[i] ),
             "Wx::GridCellCoords" ) );

  I must admit that it was more difficult than I initially thought of.

Regards
Mattia


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide Read honest & candid reviews
on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
wxperl-users mailing list
wxperl-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxperl-users


0 mark 3/30/2005 7:36:50 PM
On Wed, 30 Mar 2005 21:34:56 +0200, Mark Wardell  wrote:
> Now I am not looking at the events at all but Wx::Grid::GetSelectedCells
> does not seem to be returning the array as expected. GetSelectedRows and
> GetSelectedCols work as expected but this returns nothing.

I had some issues with GetSelectedCells too.  IIRC, it was a)
returning a weird data type (wx list maybe?) and b) didn't have the
same notion of selected cells that I wanted to use.  Thus, I wrote
this method for my grid class:

sub GetAllSelectedCells {
	my $this = shift;
	my @out;
	# GetSelectedCells only does singly selected cells, we want all
	# and processing selection block top/left + bottom/right pairs is a pain
	# and furthermore is not yet wrapped
	for my $r (0 .. $#{$this->{_sel}}) {
		for my $c (0 .. $#{$this->{_sel}[$r]}) {
			push @out, Wx::GridCellCoords->new($r, $c)
				if $this->{_sel}[$r][$c];
		}
	}
	# add the cursor cell to the list if the list is empty
	push @out, Wx::GridCellCoords->new($this->GetGridCursorRow,
		$this->GetGridCursorCol) if !@out;
	return @out;
}

To avoid manually querying each grid cell, you can see a _sel attr in
that code.  This is populated by:

#WORKAROUND: this is a workaround for Wx::Grid not having GetSelectionBlock*
sub OnSelect {
	my ($this, $evt) = @_;
	my $sel = $evt->Selecting ? 1 : 0;
	for my $r ($evt->GetTopRow .. $evt->GetBottomRow) {
		for my $c ($evt->GetLeftCol .. $evt->GetRightCol) {
			$this->{_sel}[$r][$c] = $sel;
		}
	}
	$evt->Skip; # allow normal processing
}

Setup is done in the constructor with:
	$this->{_sel} = [];
	#WORKAROUND
	EVT_GRID_RANGE_SELECT($this, \&OnSelect);

HTH,
-- 
    -- Cheetah

0 fastcat 3/30/2005 9:28:18 PM
On Wed, 30 Mar 2005 16:26:01 -0500 Cheetah  wrote:

> On Wed, 30 Mar 2005 21:34:56 +0200, Mark Wardell  wrote:
> > Now I am not looking at the events at all but Wx::Grid::GetSelectedCells
> > does not seem to be returning the array as expected. GetSelectedRows and
> > GetSelectedCols work as expected but this returns nothing.
> 
> I had some issues with GetSelectedCells too.  IIRC, it was a)
> returning a weird data type (wx list maybe?) and b) didn't have the
> same notion of selected cells that I wanted to use.  Thus, I wrote
> this method for my grid class:

  The selection access API for wxGrid is **** (if efficient);
anyway the wxPerl wrappers were missing GetSelectionBlockTopLeft and
GetSelectionBlockBottomRight (now in CVS). Please see the "Simple Grid"
demo for a rough but effective demonstration.

HTH
Mattia


0 mattia 4/3/2005 9:01:32 AM
Hi,

I tried this but found I still had problems and got nothing back, so after
modifying the demo code I found the problem to be when using a GridTable
which does not seem to play nicely with GetSelectedCells.

I modified the wxGridTableDemo by adding EVT_GRID_RANGE_SELECT and the
ShowSelections sub from the wxGrid.pm demo and I kept getting 'No cells
selected' even though all other selections (Row, Col, Block) were being
reported correctly, even the 'Range select (x,y,x2,y2)'.

I will go through the wxWidgets source and see what the differences are in
how the classes are implemented when using GridTable.

Regards
Mark

-----Original Message-----
From: wxperl-users-admin@lists.sourceforge.net
[mailto:wxperl-users-admin@lists.sourceforge.net] On Behalf Of Mattia Barbon
Sent: 03 April 2005 12:32 AM
To: Cheetah; wxperl-users@lists.sourceforge.net
Subject: Re[2]: [wxperl-users] Wx::Grid missing GetSelectedCells

On Wed, 30 Mar 2005 16:26:01 -0500 Cheetah  wrote:

> On Wed, 30 Mar 2005 21:34:56 +0200, Mark Wardell 
wrote:
> > Now I am not looking at the events at all but 
> > Wx::Grid::GetSelectedCells does not seem to be returning the array 
> > as expected. GetSelectedRows and GetSelectedCols work as expected but
this returns nothing.
> 
> I had some issues with GetSelectedCells too.  IIRC, it was a) 
> returning a weird data type (wx list maybe?) and b) didn't have the 
> same notion of selected cells that I wanted to use.  Thus, I wrote 
> this method for my grid class:

  The selection access API for wxGrid is **** (if efficient); anyway the
wxPerl wrappers were missing GetSelectionBlockTopLeft and
GetSelectionBlockBottomRight (now in CVS). Please see the "Simple Grid"
demo for a rough but effective demonstration.

HTH
Mattia



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide Read honest & candid reviews
on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
wxperl-users mailing list
wxperl-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxperl-users



0 mark 4/6/2005 10:49:49 AM
On Wed, 6 Apr 2005 12:46:08 +0200 Mark Wardell  wrote:

  Hello,

> I tried this but found I still had problems and got nothing back, so after
> modifying the demo code I found the problem to be when using a GridTable
> which does not seem to play nicely with GetSelectedCells.
> 
> I modified the wxGridTableDemo by adding EVT_GRID_RANGE_SELECT and the
> ShowSelections sub from the wxGrid.pm demo and I kept getting 'No cells
> selected' even though all other selections (Row, Col, Block) were being
> reported correctly, even the 'Range select (x,y,x2,y2)'.

  Works for me (TM). I mean: it works the same way in wxGrid.pm and
wxGridTable.pm (changes to wxGridTable.pm being committed shortly after
sending this mail).

  wxGrid always use a wxGridTable internally (wxGridStringTable, see
src/generic/grid.cpp) so there is no difference when using Wx::PlGridTable
and when not using it, especially since wxGridTableBase methods have nothing
to do with selection handling.

Regards
Mattia


0 mattia 4/9/2005 1:55:42 PM
Reply:

(Thread closed)