Re: Future of wxperl.it

2016-01-03 Thread Octavian Rasnita
Hello,

WxPerl is the best way of creating applications with a GUI with Perl. Am I 
wrong?

Because usually the applications with a GUI are targetted to common users, not 
IT specialists, it should be easy to create binary executables from those 
applications and it should be also easy to create installers for them for an 
easier distribution.

For creating binary executables is easy to use PAR, however it doesn't work 
every time, but for advanced things we have ActiveState PDK which is pretty 
fine although it costs some money. (At least PDK is OK under Windows, but I 
haven't tested it under Linux/Mac.)

For creating installers however, there is no good solution available. Cava 
Packager is kind of abandoned but not open source, although for me these are 
not its worst disadvantages, but the fact that it is inaccessible for screen 
readers. So I don't know any accessible way of creating installers that can 
install WxPerl-based applications under Linux and Mac.
CitrusPerl also looks to be abandoned unfortunately, so it is even harder to 
run a WxPerl-based app from source code because it was always hard or 
impossible to install Alien::wxWIDGETS and WxPerl using cpanm/cpan. (At least 
for me that I don't know C.)

--Octavian

  - Original Message - 
  From: Steve Cookson - gmail 
  To: James Lynes ; Ron Grunwald ; Johan Vromans 
  Cc: herbert breunung ; wxperl-users 
  Sent: Monday, January 04, 2016 1:17 AM
  Subject: Re: Future of wxperl.it


  Hi Guys,

  There is a lot of stuff on the wiki.  (See here 
http://wiki.wxperl.nl/Main_Page).  

  How to structure a good wxPerl GUI? (Possibly an existing GUI design text)
  - Do you mean a development guide?  I don't know of a good one.  
Herbert started to write one but I don't know how far he got.

  Installing wxPerl and wxWidgets
  -There is a good page on the Wiki.

  A tutorial on the wxPerl widgets and Sizers.
  - Sizers and their variety have always seemed problematic to me, 
especially all the flags they come with.  In top of that we have parents which, 
if they conflict with your parent sizer's panel send everything wrong!
  Extending your wxPerl GUI to a complete application.
  - I think we all create own architectures and that is probably a 
large duplication of effort.

  Advanced topics in wxPerl(Wrapping external libraries)
  - there is a partial write up of this on the wiki, called 
NewClass.pod.  

  Reference to wxPerl wxVARIOUS_DEFINED_TERMS available for use
  - Have you tried perl Makefile.PL --help.  It doesn't give you a 
great deal, but here it is:

  ~/wxPerl$ perl Makefile.PL --help
  Usage: perl Makefile.PL [options]
--enable/disable-foo where foo is one of: dnd filesys grid help
 html mdi print xrc stc docview calendar datetime 
--help   you are reading it
--mksymlinks create a symlink tree
--extra-libs=libsspecify extra linking flags
--extra-cflags=flags specify extra compilation flags

--[no-]wx-debug  [Non-] debugging wxWidgets
--[no-]wx-unicode[Non-] Unicode wxWidgets
--[no-]wx-mslu   [Non-] MSLU wxWidgets (Windows only)
--wx-version=2.6[.1] 
--wx-toolkit=msw|gtk|gtk2|motif|mac|wce|...

  There doesn't seem to be the same for Alien, although there is a page for 
wxWidgets, here: https://wiki.wxwidgets.org/WxWidgets_Build_Configurations

  What would you like to see see to make wxPerl be fit for another decade?

  Regards

  Steve.


  On 03/01/16 20:19, James Lynes wrote:

Ron:


I agree. My journey would have been shorter and more enjoyable with a good 
"Learning wxPerl" text. I think that the wxDemo is a good tool, but I found 
that, for a beginner, the glue code used to tie all the widgets into a neat 
package tended to obscure what was going on, which is why I broke out many of 
the widgets into separate example programs available on the wiki.(If I rewrote 
the examples today there are certainly things that could be cleaned 
up...learning curve).


The wxBook is good, but it took me quite a while to translate the C++ 
syntax into wxPerl. Today I can use the wxBook or the wxWidgets docs and 
translate pretty quickly, but it took way too long to get there. What I've 
still found missing is information on extending the GUI into a complete 
application. I do have a small working application using wxPerl with Perl 
Threads, but I'm sure there are other ways to structure the non-GUI portions of 
larger applications.


So, I guess the problem has at least six levels:

c


Nice to see a little discussion started.

So again, what needs to be done long term...


James




On Sat, Jan 2, 2016 at 7:16 PM, Ron Grunwald  wrote:

  Good morning all,

  I use WxPerl and intend to keep using it for a long time to come. 
However, I am only a beginner with WxPerl. Most of 

Re: No success trying to use Cava Packager

2013-10-18 Thread Octavian Rasnita

From: Jan Dubois j...@activestate.com

On Fri, Oct 18, 2013 at 12:25 PM, Johan Vromans jvrom...@squirrel.nl 
wrote:

IIRC, Octavian is blind and uses screen reading tools that require a
command line interface. He cannot use CP because it only has a GUI to
set up the project.


I'm sure Octavian will correct me if I misrepresent it, but I think
you have it exactly backwards: GUIs are a lot easier to use for vision
impaired people than commandlines, as long as the GUI has proper
accessibility support.



Yes, GUIs are easier to use than command line, but the GUIs might have 
accessibility problems that might make the application absolutely 
inaccessible, while the CLI programs are always accessible if all their 
functions can be specified by parameters.
If the CLI programs also offer a kind of graphical representation they might 
have the same accessibility problems.


So from the accessibility point of view, a program like ActiveState PDK is 
much better accessible, because perlapp and other programs in it can be 
accessed using parameters.


PAR also offers a better accessibility, but I tried it and gave some errors 
I couldn't solve, and after I asked here on the list I was told that Cava 
Packager is a better solution.
It would be nice if the functions which are provided by GUI could be also 
done by using parameters...


It is too bad, because there is no other better and accessible portable 
solution than WxPerl, so the only alternative would be another language than 
Perl.





That means the GUI needs to be navigable using TABs, and all controls
need to have proper captions that announce wherever you are inside a
dialog. That way you can quickly navigate to whatever field you need
without having to read all of the screen contents.

The commandline however lacks this kind of structures, so you
basically have to listen to the screen reader to read out
*everything*, or you abort and are back at the prompt...

I think much of the accessibility control is provided by the Windows
GUI libs, so the support comes there for free. That is, I think
wxPerl has proper accessibility support on Windows, but not on Linux,
so Cava Packager would probably fine for Octavian on Windows.



Yes, that's true.
Under Linux Orca screen reader is able to access the menus in Cava and a few 
other standard dialogs like those for opening/saving files, but some of the 
other widgets are not accessible. And I don't know why. Even they are custom 
widgets and not standard widgets, or they are not placed on a panel but 
directly on the window (and I found that makes them less accessible under 
Windows also).


I created a free app with WxPerl and it uses an edit combo, a combo box, a 
check box, a button, a richtext multiline edit field, a toolbar, menus, and 
I ran it under Linux, but it is entirely accessible with Orca screen reader. 
Even the toolbar is accessible.
So I think the native GUI lib used by WxPerl under Linux is accessible, so 
Cava Packager should be accessible also.


Octavian



Is Cava Packager open source?

2013-10-12 Thread Octavian Rasnita

Hi,

I read something about the free license of using Cava, but I didn't 
understand if it is open source also and I didn't find its source code.


I am interested in its source because I am trying to find if I can do 
something to make it accessible for Orca screen reader under Linux.
Seems that there is no other alternative of deploying WxPerl apps that 
really works and it is too bad that it can't be totally used in CLI mode or 
with an accessible GUI version.


--Octavian



Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-05-01 Thread Octavian Rasnita

Yep, good to know.

It would be nice if WxPerl would announce somehow that a font doesn't have 
the necessary glifs (maybe with a warning).


And btw, if the constant wxVSCROLL  is not necessary, (do I understood 
correctly that it is not necessary under Linux either?) and if it creates 
problems under Windows, it would be helpful if it would give an error when 
it is used, or it would be helpful if it would be skipped at least under 
platforms that have a problem with it.


--Octavian

- Original Message - 
From: Mark Dootson mark.doot...@znix.com

To: wxperl-users@perl.org
Sent: Wednesday, May 01, 2013 8:18 PM
Subject: Re: Can we print UTF-8 chars in Wx::TextCtrl fields?



Hi,

Just a clarification.

Setting the font so that you get glyphs displayed properly is only an 
issue on Windows XP.


More recent versions of Windows have default GUI fonts that have a much 
wider range of glyphs available so this isn't an issue.


Unless, strangely, you force 'Verdana' which seems to be the font 
Microsoft forgot.


Regards

Mark


On 01/05/2013 17:35, Mark Dootson wrote:

Hi,

On 01/05/2013 15:21, Octavian Rasnita wrote:

Thank you Mark! Now the chars are displayed fine.

Too bad that I need to use Windows...

BTW, what happends if this program runs under Linux or Mac?
Will WxPerl use another sans-serif font available under these platforms?


Yes - a similar font chosen on the basis of wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL.

For both Linux and MacOSX (modern editions I've just tested at least) if
the font does not contain a glyph to represent a character, the font
engine will check other fonts until it finds one that does.

Regards

Mark







Re: wxString and UTF-8, utf8 etc etc etc again

2013-05-01 Thread Octavian Rasnita
From: Mark Dootson mark.doot...@znix.com


 Hi,
 
 On 02/05/2013 00:17, Steve Cookson wrote:
 
 Or just

 sub libDecode ($$){
 return decode(@_);
 }

 At least all the things that might go wrong will all be here.
 
 You're unduly worried ( probably my fault ).
 
 my $string = decode($encoding, $binary);
 


So no need of utf8::upgrade()?

Octavian



Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-30 Thread Octavian Rasnita

Hi Mark,

I tried your suggestion and I removed the constant wxVSCROLL  from the 
attributes of Wx::TextCtrl constructor, but the UTF-8 encoded chars still 
appear as squares.

I use Windows XP Pro and ActivePerl 5.14.2.
(I need to use ActivePerl and not another distribution because I need to 
create a COM server with this application.)


Then I tried adding:
utf8::upgrade( $text );
then
$textfield-AppendText( $text );

But no difference. Those chars still appear as squares.

Then I also added:

use Encode;
$text = decode('utf8', $text );
utf8::upgrade( $text );

But this time it gave the following error:

Cannot decode string with wide characters at D:/usr/lib/Encode.pm line 176.

The scalar $text is obtain from an SQLite database and I connect to it 
using:


my $dbh = DBI-connect(dbi:SQLite:test.db);
$dbh-do(PRAGMA cache_size = 8);
$dbh-do(PRAGMA synchronous = OFF);
$dbh-{sqlite_unicode} = 1;

The new cod with the SQLite db is at:

http://maestrodex.ro/static/test2.zip

I selected the record from this DB in command line and I've seen that the 
special char ț appears as 2 chars, so I think the char is added well in 
DB.


--Octavian

- Original Message - 
From: Mark Dootson mark.doot...@znix.com

To: steveco.1...@gmail.com; wxperl-users@perl.org
Sent: Monday, April 29, 2013 4:32 PM
Subject: Re: Can we print UTF-8 chars in Wx::TextCtrl fields?



Hi,

A Perl scalar has a character buffer to store character or byte data. This 
data can be interpreted and stored by Perl in one of two formats:


1. Perl's internal data format
2. A number octets (bytes) representing a UTF-8 encoded string.

Internally it is just a memory buffer. Each scalar has a utf8 flag. This 
tells Perl internally how to interpret its data buffer. Either as Perl's 
internal data format or as UTF-8 encoded text. If the utf8 flag is on, 
Perl regards the buffer as UTF-8 encoded text. If the utf8 flag is off, 
Perl regards the buffer as containing data in Perl's internal format.


So, say I load some binary data that I know is text encoded using 
'ISO-8859-1'.


Then I would do:

my $string = decode('ISO-8859-1', $binary);

This gets $string which contains data in Perl's internal format. The utf8 
flag for the scalar '$string' is off As you have noted below, I can't pass 
'$binary' to any of Perl's string functions. The results will be 
unpredictable and mostly bad.


The evil starts due to some special features when we use decode to convert 
a UTF-8 encoded string.


my $string = decode('utf8', $binary);

If $binary can be converted to $string using single byte characters, then 
$string will be in Perl's internal data format and marked as such. (utf8 
flag off). If $binary contains multiple byte characters the $string will 
contain a series of bytes representing a UTF-8 encoded string and the 
scalar '$string' will have the utf8 flag on.


Within Perl it should not matter whether the scalar is marked UTF-8 or 
not - so long as the utf8 flag correctly reflects what's in the scalar's 
data buffer.


The problem comes when we come to pass the data to the wxWidgets library.

The source macro that does this is:

#define WXSTRING_INPUT( var, type, arg ) \
  var =  ( SvUTF8( arg ) ) ? \
   wxString( SvPVutf8_nolen( arg ), wxConvUTF8 ) \
 : wxString( SvPV_nolen( arg ), wxConvLibc );


So basically, if the scalar is marked as 'utf8' then it gets converted 
into a wxString as such. If not, you're at the mercy of libc and local 
system settings. It may work. It may not.



Solution - your conversion of external data should be

 my $string = decode($encoding, $binary);
 utf8::upgrade($string);

This should be platform independent and work - always. Perl's string 
functions should all work OK on $string.


The key points

my $string = decode('utf8', $binary);

It depends on the content of $binary whether $string has the utf8 flag 
set.


my $string = decode('utf8', $binary);
utf8::upgrade( $string );

$string always has utf8 flag set. You could just do utf8::upgrade($binary) 
but that would be a special case for when $binary actually contains UTF-8 
bytes. The two step method applies to any encoding.


Perl can't know that a scalar contains UTF-8 encoded text unless you tell 
it.


The statement:

'use utf8;' Is not needed anywhere here of course as it indicates that the 
source code is encoded in UTF-8. Nothing more. Functions utf8::upgrade 
etc. are always available.


If you have a list of scalars containing strings as in

@combo_options

then the same applies - to each individual scalar / string in the list.


Hope it helps.


Mark


On 29/04/2013 12:29, steveco.1...@gmail.com wrote:


Hi Mark, I'm a relative new comer to utf8 so please take everything I say
with a pinch of salt but your answer looks a bit qualified: if scalar, if
marked. That implies if I want a Perl list (say @combo_options) for a
Wx::ComboBox, then that won't work? Is that how it is?

And I don't know what marked means.

The real problem for me is 

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-30 Thread Octavian Rasnita

I have tried this but it still displays squares instead of UTF-8 chars.
(I deleted the line with decode() and I set the font to Arial.)

The new test file is at:

http://maestrodex.ro/static/test3.zip

--Octavian

- Original Message - 
From: Mark Dootson mark.doot...@znix.com

To: Octavian Rasnita orasn...@gmail.com
Cc: steveco.1...@gmail.com; wxperl-users@perl.org
Sent: Tuesday, April 30, 2013 10:43 PM
Subject: Re: Can we print UTF-8 chars in Wx::TextCtrl fields?



Hi,

Comment out the line

  $text = decode('utf8', $text );

you do not need it.

Change the font name requested to 'Arial'.

Everything should work.

I'll try to figure out if there's a way to query a font to check if it has 
glyphs for particular code points. The old Font Encoding setting seems 
useless here.


Regards

Mark



On 30/04/2013 20:29, Octavian Rasnita wrote:

Hi Mark,

I tried your suggestion and I removed the constant wxVSCROLL  from the
attributes of Wx::TextCtrl constructor, but the UTF-8 encoded chars
still appear as squares.
I use Windows XP Pro and ActivePerl 5.14.2.
(I need to use ActivePerl and not another distribution because I need to
create a COM server with this application.)

Then I tried adding:
utf8::upgrade( $text );
then
$textfield-AppendText( $text );

But no difference. Those chars still appear as squares.

Then I also added:

use Encode;
$text = decode('utf8', $text );
utf8::upgrade( $text );

But this time it gave the following error:

Cannot decode string with wide characters at D:/usr/lib/Encode.pm line 
176.


The scalar $text is obtain from an SQLite database and I connect to it
using:

my $dbh = DBI-connect(dbi:SQLite:test.db);
$dbh-do(PRAGMA cache_size = 8);
$dbh-do(PRAGMA synchronous = OFF);
$dbh-{sqlite_unicode} = 1;

The new cod with the SQLite db is at:

http://maestrodex.ro/static/test2.zip

I selected the record from this DB in command line and I've seen that
the special char ț appears as 2 chars, so I think the char is added
well in DB.

--Octavian

- Original Message - From: Mark Dootson mark.doot...@znix.com
To: steveco.1...@gmail.com; wxperl-users@perl.org
Sent: Monday, April 29, 2013 4:32 PM
Subject: Re: Can we print UTF-8 chars in Wx::TextCtrl fields?



Hi,

A Perl scalar has a character buffer to store character or byte data.
This data can be interpreted and stored by Perl in one of two formats:

1. Perl's internal data format
2. A number octets (bytes) representing a UTF-8 encoded string.

Internally it is just a memory buffer. Each scalar has a utf8 flag.
This tells Perl internally how to interpret its data buffer. Either as
Perl's internal data format or as UTF-8 encoded text. If the utf8 flag
is on, Perl regards the buffer as UTF-8 encoded text. If the utf8 flag
is off, Perl regards the buffer as containing data in Perl's internal
format.

So, say I load some binary data that I know is text encoded using
'ISO-8859-1'.

Then I would do:

my $string = decode('ISO-8859-1', $binary);

This gets $string which contains data in Perl's internal format. The
utf8 flag for the scalar '$string' is off As you have noted below, I
can't pass '$binary' to any of Perl's string functions. The results
will be unpredictable and mostly bad.

The evil starts due to some special features when we use decode to
convert a UTF-8 encoded string.

my $string = decode('utf8', $binary);

If $binary can be converted to $string using single byte characters,
then $string will be in Perl's internal data format and marked as
such. (utf8 flag off). If $binary contains multiple byte characters
the $string will contain a series of bytes representing a UTF-8
encoded string and the scalar '$string' will have the utf8 flag on.

Within Perl it should not matter whether the scalar is marked UTF-8 or
not - so long as the utf8 flag correctly reflects what's in the
scalar's data buffer.

The problem comes when we come to pass the data to the wxWidgets 
library.


The source macro that does this is:

#define WXSTRING_INPUT( var, type, arg ) \
  var =  ( SvUTF8( arg ) ) ? \
   wxString( SvPVutf8_nolen( arg ), wxConvUTF8 ) \
 : wxString( SvPV_nolen( arg ), wxConvLibc );


So basically, if the scalar is marked as 'utf8' then it gets converted
into a wxString as such. If not, you're at the mercy of libc and local
system settings. It may work. It may not.


Solution - your conversion of external data should be

 my $string = decode($encoding, $binary);
 utf8::upgrade($string);

This should be platform independent and work - always. Perl's string
functions should all work OK on $string.

The key points

my $string = decode('utf8', $binary);

It depends on the content of $binary whether $string has the utf8 flag
set.

my $string = decode('utf8', $binary);
utf8::upgrade( $string );

$string always has utf8 flag set. You could just do
utf8::upgrade($binary) but that would be a special case for when
$binary actually contains UTF-8 bytes. The two step method applies to
any encoding.

Perl can't know

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-29 Thread Octavian Rasnita

Hi Mark,

Thank you for this great explanation. Much clearer than other 
documentations.


--Octavian

- Original Message - 
From: Mark Dootson mark.doot...@znix.com

To: steveco.1...@gmail.com; wxperl-users@perl.org
Sent: Monday, April 29, 2013 4:32 PM
Subject: Re: Can we print UTF-8 chars in Wx::TextCtrl fields?



Hi,

A Perl scalar has a character buffer to store character or byte data. This 
data can be interpreted and stored by Perl in one of two formats:


1. Perl's internal data format
2. A number octets (bytes) representing a UTF-8 encoded string.

Internally it is just a memory buffer. Each scalar has a utf8 flag. This 
tells Perl internally how to interpret its data buffer. Either as Perl's 
internal data format or as UTF-8 encoded text. If the utf8 flag is on, 
Perl regards the buffer as UTF-8 encoded text. If the utf8 flag is off, 
Perl regards the buffer as containing data in Perl's internal format.


So, say I load some binary data that I know is text encoded using 
'ISO-8859-1'.


Then I would do:

my $string = decode('ISO-8859-1', $binary);

This gets $string which contains data in Perl's internal format. The utf8 
flag for the scalar '$string' is off As you have noted below, I can't pass 
'$binary' to any of Perl's string functions. The results will be 
unpredictable and mostly bad.


The evil starts due to some special features when we use decode to convert 
a UTF-8 encoded string.


my $string = decode('utf8', $binary);

If $binary can be converted to $string using single byte characters, then 
$string will be in Perl's internal data format and marked as such. (utf8 
flag off). If $binary contains multiple byte characters the $string will 
contain a series of bytes representing a UTF-8 encoded string and the 
scalar '$string' will have the utf8 flag on.


Within Perl it should not matter whether the scalar is marked UTF-8 or 
not - so long as the utf8 flag correctly reflects what's in the scalar's 
data buffer.


The problem comes when we come to pass the data to the wxWidgets library.

The source macro that does this is:

#define WXSTRING_INPUT( var, type, arg ) \
  var =  ( SvUTF8( arg ) ) ? \
   wxString( SvPVutf8_nolen( arg ), wxConvUTF8 ) \
 : wxString( SvPV_nolen( arg ), wxConvLibc );


So basically, if the scalar is marked as 'utf8' then it gets converted 
into a wxString as such. If not, you're at the mercy of libc and local 
system settings. It may work. It may not.



Solution - your conversion of external data should be

 my $string = decode($encoding, $binary);
 utf8::upgrade($string);

This should be platform independent and work - always. Perl's string 
functions should all work OK on $string.


The key points

my $string = decode('utf8', $binary);

It depends on the content of $binary whether $string has the utf8 flag 
set.


my $string = decode('utf8', $binary);
utf8::upgrade( $string );

$string always has utf8 flag set. You could just do utf8::upgrade($binary) 
but that would be a special case for when $binary actually contains UTF-8 
bytes. The two step method applies to any encoding.


Perl can't know that a scalar contains UTF-8 encoded text unless you tell 
it.


The statement:

'use utf8;' Is not needed anywhere here of course as it indicates that the 
source code is encoded in UTF-8. Nothing more. Functions utf8::upgrade 
etc. are always available.


If you have a list of scalars containing strings as in

@combo_options

then the same applies - to each individual scalar / string in the list.


Hope it helps.


Mark


On 29/04/2013 12:29, steveco.1...@gmail.com wrote:


Hi Mark, I'm a relative new comer to utf8 so please take everything I say
with a pinch of salt but your answer looks a bit qualified: if scalar, if
marked. That implies if I want a Perl list (say @combo_options) for a
Wx::ComboBox, then that won't work? Is that how it is?

And I don't know what marked means.

The real problem for me is that this feels like the wrong place to 
decode.
There are lots of things I might want to do with a string before I 
display

it.  I might want to sort it, or trim white space, or substitute a
place-marker with a value.  And for these I need it to be decoded before 
I

process it.  If I have a very simple app with no string processing, then
this approach would be great but not otherwise.

I did have a lot of issues with utf8 at the beginning sometimes I had
display issues with a utf8 string and sometimes not.  There seemed to be 
no
particular rhyme or reason to it.  And as you say, it works differently 
on
Windows and Linux.  Finally, everything is very sensitive to small 
errors,

like having a non-existent style code.

So I use a policy which is that when I read a value into my program from 
a
database or a file, I always decode immediately.  That way I know that 
all

my variables are decoded and processable.

Then I encode before I write back to the file or db.

If I have an issue now, it is always where I have not done a:

$var = 

Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-22 Thread Octavian Rasnita

Hi,

I have a text field defined as:

   $self-{defs} = Wx::TextCtrl-new(
   $self-{panel},
   -1,
   ,
   wxDefaultPosition,
   [ 500, 400 ],
   wxTE_MULTILINE | wxTE_READONLY | wxVSCROLL | wxTE_PROCESS_ENTER |
 wxTE_RICH2
   );

And I am trying to set a font for it using:

   my $font = Wx::Font-new( $FontSize}, wxFONTFAMILY_SWISS, 
wxFONTSTYLE_NORMAL,

   wxFONTWEIGHT_NORMAL, 0, Arial Unicode MS, wxFONTENCODING_SYSTEM );

   my $style = Wx::TextAttr-new;
   $style-Wx::TextAttr::SetFont($font);
   $self-{defs}-SetDefaultStyle($style);

But if I print UTF-8 chars in this field, it prints squares instead of 
special UTF-8 chars (non ASCII).

Should it work this way and the text might be wrong UTF-8 encoded?

I also read in the WxPerl documentation:


The known font encodings are:
...
wxFONTENCODING_UTF8,// UTF-8 Unicode encoding


So I tried to change wxFONTENCODING_SYSTEM with wxFONTENCODING_UTF8 in the 
code above.

But this just makes WxPerl to pop up a window that tells:


Wx::SimpleApp: unknown encoding
No font for displaying text in encoding 'Unicode 8 bit (UTF-8)' found.Would 
you like to select a font to be used for this encoding

(otherwise the text in this encoding will not be shown correctly)?
Yes No


So I created another small program to find which are the available 
encodings:


use Wx ':everything';
use Data::Dump 'pp';
my $enum = Wx::FontEnumerator-new;
my @encodings = $enum-GetEncodings;
print pp \@encodings;

And the result was:

[
 WINDOWS-1250,
 WINDOWS-437,
 unknown-87,
 WINDOWS-1252,
 WINDOWS-1255,
 WINDOWS-1256,
 WINDOWS-1253,
 WINDOWS-1254,
 WINDOWS-1257,
 WINDOWS-1251,
 unknown--1,
 WINDOWS-874,
 unknown--1,
 WINDOWS-932,
 WINDOWS-949,
 unknown--1,
 WINDOWS-936,
 WINDOWS-950,
]

So there is no encoding that contains UTF-8 in its name.
Does this mean that WxPerl can't print UTF-8 texts?

Or there is something else I need to do?

In the same documentation page, when describing the constructor of the 
Wx::Font object, it describes the encoding parameter as:



encoding

   An encoding which may be one of
wxFONTENCODING_SYSTEM
wxFONTENCODING_DEFAULT
wxFONTENCODING_ISO8859_1...15
wxFONTENCODING_KOI8
wxFONTENCODING_CP1250...1252


In this list of possible encodings appear only these items, and no one that 
includes UTF8.


Eventually, is there an example of writing text with a certain font that 
supports UTF-8?


Thanks.

--Octavian



Display UTF-8 chars in rich text fields

2013-04-21 Thread Octavian Rasnita

Hi,

I am trying to display UTF-8 text in a richtext field using the following 
code:


my $font = Wx::Font-new( $font_size, wxFONTFAMILY_SWISS, 
wxFONTSTYLE_NORMAL,

   wxFONTWEIGHT_NORMAL, 0, Verdana, wxFONTENCODING_UTF8 );

But when I run the program, it appears a nice window with the following 
message:


Wx::SimpleApp: unknown encoding
No font for displaying text in encoding 'Unicode 8 bit (UTF-8)' found.
Would you like to select a font to be used for this encoding (otherwise the 
text in this encoding will not be shown correctly)?

Yes No

And if I press the button Yes, I can choose one of the fonts I have 
installed. I've seen that some of them have the name Unicode in their 
names, for example Arial Unicode MS so I replaced the font name Verdana 
in the code above with Arial Unicode MS.


But no luck. If I run the program again, the same message appears.

I am running Perl 14.2 under Windows XP Pro with WxPerl 0.9904.

Until now I used the constant wxFONTENCODING_SYSTEM and the program worked 
fine without appearing that window that promps for the font, but of course, 
the UTF-8 chars were displaying as squares.


Please tell me what I am doing wrong.

Thanks.

--Octavian



Re: wxperl screenshots

2013-01-20 Thread Octavian Rasnita
Hi Waldemar,

Unfortunately it is not possible because Win32::GUI and WxPerl have totally 
different interfaces.

So you should need to totally replace the part of the program that draws the 
GUI.

--Octavian

- Original Message - 
From: Waldemar Biernacki w...@sao.pl
To: wxperl-users@perl.org
Sent: Sunday, January 20, 2013 10:57 AM
Subject: Re: wxperl screenshots


Johan,

thank you.

Nice screens. 

I think I'll get another chance for wxperl.

I've got a question - specially to those who used Win32::GUI library 
(Octavian?):
would be possible to replace Win32::GUI to Wx on the fly? Or rather 
shoul I redesign my application from bottom to top?

Thanks again Johan

Regards

wb.


Dnia sobota, 19 stycznia 2013 o 23:50:53 Johan Vromans napisał:
 Waldemar Biernacki w...@sao.pl writes:
 
  Is it possible to see the best screenshots of your applications? 
 
 http://www.squirrel.nl/pub/xfer/uploads/3CpjfksNlHctfWOUhqHUmTTQ.zip
 
 -- Johan



Re: wxperlbook

2013-01-05 Thread Octavian Rasnita

Hi Herbert,

Talking about modern Perl, I think it could be useful to see examples of 
using WxPerl with Moose/Moo.


Also, maybe even more useful could be some examples of using WxPerl to 
create multi threading applications (because this is often needed for 
desktop apps).


Another helpful example would be one that uses I18N and allows changing the 
language of the interface on runtime, without needing to reload the app.


Thanks for the book.

BTW, is it necessary to login on bitbucket to be able to get it?

--Octavian

- Original Message - 
From: herbert breunung deirdre_s...@web.de

To: wxperl-users wxperl-users@perl.org
Sent: Friday, January 04, 2013 9:54 PM
Subject: wxperlbook



dear list readers,

i want to use the momentum of the latest post thread,
to clearify what i intent to do with the wxperlbook
https://bitbucket.org/lichtkind/wxperlbook/src
(merge requests and commit bits will be handled liberaly).

yeah wee need a book, examples demo apps,
all that i want to provide andI shown my ability with various
talks on yapc and german perl workshops and most notably
with a 12 part wxperl tutorial in the German perl magazine
which run over 2 years and is sorta basis of i try to do.

this also the reasons why i have to do now 2 other articles and will do 
more

on that front later

severl chapter will be about doing a complete app , mostly smaller helpull
tools or interesting graphical toys to reignite playfulness, fun and yoi 
in
programming with perl in general. but the main app developed over most 
other

chapters will be a new type of doc viewer for oo.structured code like wx
itself but also any other module which has to leace its docs in a 
structured
way. i shared some ideas with brian d foy on that. i know it qiote a 
larger
effort but one of my major todos for this year and i would be edlighted if 
you
want to join and help me in this. i plan also in this effort in some 
helper
modules and a Bundle::Wx module with all the helpful and maintained 
extentions

but i want to learn dzil first.
cromatic already agreed that it will be published as a modern perl book.

if you have any further ideas pleas comment here :)

thanks for reading
herbert 




Re: wxPerl past, wxPerl present and wxPerl future.

2013-01-03 Thread Octavian Rasnita

From: Waldemar Biernacki w...@sao.pl


My opinion is very similar to that of Sergei's.

I trace the list for few years but use Prima library:

1. Prima is very easy installable in Windows and Linux
2. Prima has very good examples,
3. Prima has quite good pdf documantation,
4. and has very perlish style.

The only minus of Prima is that there is only very few people that use it.



Another big minus is that it doesn't create interfaces accessible for screen 
readers, so the programs it creates won't be accessible for the blind.



I've tried very hard to use wxPerl but:

1. wxPerl sometimes doesn't wanted to be installed,


I always installed WxPerl using ppm and it worked fine every time. Now there 
is also the wonderful Citrus Perl which can be installed under Win/Linux/Mac 
and it includes WxPerl.


2. no good examples (If I remember well, there was some demo application 
which contains examples,

but I coudn't easily extract the valuable subsets),


Yes, I found the same thing. I think it would have been much better if 
instead of that big demo app with many modules there were many standalone 
scripts. Harder to write duplicate code, but easier to understand by a 
beginner.



3. When I decided to build an application using some book rules I didn't 
find any book/html -
no documantation. Just ad-hoc pieces of advice and a list of the modules - 
many, many times

without full description.



There is a big .chm file which is very nice and easy to use, but 
unfortunately it may be very hard to understand because it presents the C 
syntax, not the Perl one, and if we don't know C...


Octavian



installing an older version of WxPerl?

2012-04-03 Thread Octavian Rasnita

Hi,

Is it possible to install WxPerl 0.9701 under Windows using ppm?

The latest versions of WxPerl (0.9901) installed from WxPerl repository 
doesn't work well with ActivePerl 5.10 because the multiline text fields 
appear as password text fields, and I need to use ActivePerl 5.10.


The latest version of WxPerl from ActiveState's repository (0.9904) doesn't 
work at all with ActivePerl 5.10 because it appears a fatal error window 
without any helpful message.


A recommendation for other Perl distribution is welcomed if they can be used 
for creating Windows executables and COM components.


Thanks.

--Octavian



Re: installing an older version of WxPerl?

2012-04-03 Thread Octavian Rasnita
Hi Mark,

From: Mark Dootson mark.doot...@znix.com
Subject: Re: installing an older version of WxPerl?


 Hi,
 
 On 03/04/2012 19:38, Octavian Rasnita wrote:
 Hi,

 Is it possible to install WxPerl 0.9701 under Windows using ppm?

 The latest versions of WxPerl (0.9901) installed from WxPerl repository
 doesn't work well with ActivePerl 5.10 because the multiline text fields
 appear as password text fields, and I need to use ActivePerl 5.10.
 
 This difference is almost certainly nothing to do with the wxPerl 
 version. It may be because of the wxWidgets version or build, I don't 
 know. 

Oh, I thought that when installing WxPerl it requires by default the right 
wxWIDGETS. When I'll reach home I will check to see what's the version of 
wxWIDGETS installed.


 Are you sure that it is password text? I'm thinking that maybe 
 there is a problem with multi-line text boxes + encoding handling so you 
 would get something character set dependent - on my machine that shows 
 as a lot of empty 'square' symbols.
 

Well, I am not sure. :-)
I have used a screen reader (JAWS) which reports that field as beeing password 
field and it reads only stars in it. And I can't write anything in that field...

 I doubt that building Wx version 0.9701 will help. Could you let me know 
 the following and I'll see if I can repeat the problem:
 
 ActivePerl build number ( 1002 / 1007 etc)

ActivePerl build 1007

 Windows version (XP, Vista, etc)
 64 or 32 bit Windows

Windows XP Pro 32 bit

 64 or 32 bit ActivePerl (you could have 32 bit AP on 64 bit machine)

32 bit ActivePerl

 I will not be building any new ppms for Perl 5.10 ( or 5.8 for that 
 matter ) as Perl 5.16 looms near and I think you may find it difficult 
 to source community supported ppms for Perl 5.10 in particular.

I could have installed WxPerl with cpan, but I have never succeeded to do that 
using the C compiler that comes with Active Perl's cpan...

 The latest version of WxPerl from ActiveState's repository (0.9904)
 doesn't work at all with ActivePerl 5.10 because it appears a fatal
 error window without any helpful message.
 
 I didn't think there were any regularly updated community available 
 ActiveState repositories for Perl 5.10 ? Perhaps there are. I assume you 
 don't have Perl 5.10.0 - it is 5.10.1 you have? Either way, the two are 
 not compatible so be sure you are pointing at the right repository.

I have 5.10.1 but I will check to see if I tried to install for 5.10.0. I doubt 
this however, because I installed other modules from that repository and they 
work fine, but... who knows, maybe those modules that work don't use XS code...

 A recommendation for other Perl distribution is welcomed if they can be
 used for creating Windows executables and COM components.
 
 If you are interested in creating COM components, then I'm not aware of 
 any comparable solution to the PDK from ActiveState so you should stick 
 with that.
 
 My advice, for what it is worth, is that you need to overcome whatever 
 it is stopping you using Perl 5.14 as using Perl 5.10 will present 
 greater and greater difficulties for you as time moves on.


Well, the difficulty is that only newer versions of PDK work with ActivePerl 
5.14, and I need it to create a program which will be offered for free.
Otherwise... that program works very well with ActivePerl 5.14 and latest 
WxPerl.

Thanks.

Octavian



Citrus Perl

2011-12-26 Thread Octavian Rasnita
Hi,

I read that Citrus Perl is targetted for creating desktop apps for Win and Mac.
Does anyone know if it is also possible to use Citrus Perl for creating ActiveX 
COM servers with it? (like with ActiveState's perlctrl?)

Thanks.

Octavian



Creating a package with perlapp

2011-12-21 Thread Octavian Rasnita
Hi,

I have a strange problem with a WxPerl-based program I made a few years ago.
No matter if I run it with Perl directly or from a perlapp package, all the 
controls and menus it uses show and work fine, but 2 multiline fields don't 
work nor show well.

Actually I don't know how they show, but my screen reader sees them now as 
read-only password fields with a star in them, and I can't write inside them.
They are created with the code:

$self-{SourceText} = Wx::TextCtrl-new($self-{panel}, -1, 
, wxDefaultPosition, [500, 200], wxTE_MULTILINE|wxVSCROLL);

They were working well in the past, and they are also working fine in the 
Windows executable created with perlapp a few years ago.
Just for testing, I have removed wxTE_MULTILINE|wxVSCROLL and I was able to 
use them this way.

I use Perl 5.10.1, WxPerl 0.99.0.1 under Windows XP Pro.

Please tell me if the syntax for using a multiline text field has changed, or 
if I have done something wrong from the start.
I have included a longer part of code after my message... maybe it helps.

Thanks a lot.

Octavian


sub new {
my ( $class, $config ) = @_;
my $self = $class-SUPER::new( undef, -1, MT, [ -1, -1 ], [ -1, -1 ] );

#Some lines skipped here - configuration, I18N...

$self-{panel} = Wx::Panel-new( $self, -1, wxDefaultPosition, 
wxDefaultSize );

$self-{SourceLanguage_label} = Wx::StaticText-new( $self-{panel}, -1, 
t(Source language:), wxDefaultPosition, wxDefaultSize );

$self-{SourceLanguage} = Wx::ComboBox-new( $self-{panel}, -1, , 
wxDefaultPosition, wxDefaultSize, [], wxCB_READONLY );

$self-{DestinationLanguage_label} = Wx::StaticText-new( $self-{panel}, 
-1, t(Destination language:), wxDefaultPosition, wxDefaultSize );

$self-{DestinationLanguage} = Wx::ComboBox-new( $self-{panel}, -1, , 
wxDefaultPosition, wxDefaultSize, [], wxCB_READONLY );

# Here is the first control that doesn't work well:

$self-{SourceText} = Wx::TextCtrl-new($self-{panel}, -1, , 
wxDefaultPosition, [500, 200], wxTE_MULTILINE|wxVSCROLL);

#But the following temporary replacement - single line works:

#$self-{SourceText} = Wx::TextCtrl-new( $self-{panel}, -1, , 
wxDefaultPosition, [ 500, 200 ] );

$self-{TranslateButton} = Wx::Button-new( $self-{panel}, -1, 
t(Translate), wxDefaultPosition, wxDefaultSize );
$self-{TranslateButton}-SetDefault;

$self-{StopButton} = Wx::Button-new( $self-{panel}, -1, t(Stop), 
wxDefaultPosition, wxDefaultSize );
$self-{StopButton}-Disable;

#And here is the second control that doesn't work:

$self-{DestinationText} = Wx::TextCtrl-new($self-{panel}, -1, , 
wxDefaultPosition, [500, 200], wxTE_MULTILINE|wxVSCROLL);

#But its temporary replacement - single line works:
#$self-{DestinationText} = Wx::TextCtrl-new( $self-{panel}, -1, , 
wxDefaultPosition, [ 500, 200 ] );

$self-{ProgressBar} = Wx::Gauge-new( $self-{panel}, -1, 100, 
wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL | wxGA_SMOOTH );

$self-{StatusBar} = Wx::StatusBar-new( $self-{panel}, -1 );
$self-{StatusBar}-SetStatusText( t( MT version {version}, version = 
$VERSION ) );

$self-{sizer0} = Wx::BoxSizer-new(wxVERTICAL);
$self-{sizer0}-Add( $self-{panel}, 1, wxGROW, 0 );
$self-SetSizer( $self-{sizer0} );
$self-{sizer0}-SetSizeHints($self);

$self-{sizer1} = Wx::BoxSizer-new(wxHORIZONTAL);
$self-{sizer1}-AddWindow( $self-{SourceLanguage_label},  0 );
$self-{sizer1}-AddWindow( $self-{SourceLanguage},0 );
$self-{sizer1}-AddWindow( $self-{DestinationLanguage_label}, 0 );
$self-{sizer1}-AddWindow( $self-{DestinationLanguage},   0 );

$self-{sizer3} = Wx::BoxSizer-new(wxHORIZONTAL);
$self-{sizer3}-AddWindow( $self-{TranslateButton}, 0, wxALIGN_CENTER );
$self-{sizer3}-AddWindow( $self-{StopButton},  0, wxALIGN_CENTER );

$self-{sizer2} = Wx::BoxSizer-new(wxVERTICAL);
$self-{sizer2}-Add( $self-{sizer1}, 0, wxALIGN_CENTER );
$self-{sizer2}-AddWindow( $self-{SourceText}, 1, wxGROW );
$self-{sizer2}-Add( $self-{sizer3} );
$self-{sizer2}-AddWindow( $self-{DestinationText}, 1, wxGROW );
$self-{sizer2}-AddWindow( $self-{ProgressBar}, 0, wxALIGN_CENTER );
$self-{sizer2}-AddWindow( $self-{StatusBar},   0, wxGROW );
$self-{panel}-SetSizer( $self-{sizer2} );
$self-{sizer2}-SetSizeHints( $self-{panel} );

$self-SetSize( 700, 600 );

#Here are defined the event handlers for menus and controls

my $sendqueue = Thread::Queue-new;
my $worker = threads-create( \worker, $self, $sendqueue );

$self-{queue}  = $sendqueue;
$self-{worker} = $worker;

$self-Show(1);

return $self;
}




Re: What good is a Wx::Panel?

2011-06-07 Thread Octavian Rasnita
OK, but does this mean that if we use some styles for a certain control, we 
should also specify explicitly the default styles because otherwise they 
won't be used as a default?


--Octavian

- Original Message - 
From: Mark Dootson mark.doot...@znix.com

To: Octavian Rasnita orasn...@gmail.com
Cc: wxperl-users@perl.org
Sent: Monday, June 06, 2011 7:04 PM
Subject: Re: What good is a Wx::Panel?



Hi,

wxTAB_TRAVERSAL is the default style setting for Wx::Panel. I only need to 
be explicit about it as I'm setting other style flags in the constructor.


It is possible to have a Wx::Panel get the focus, and if you don't have 
the wxTAB_TRAVERSAL set, navigation may not work as expected. (The panel 
will receive your key events rather than the child controls).


Unless you are setting some flags explicitly yourself in the constructor, 
Wx::Panel will have the syle wxTAB_TRAVERSAL set by default.


Rgds

Mark


On 06/06/2011 16:59, Octavian Rasnita wrote:

Hi Mark,

Why is wxTAB_TRAVERSAL needed in a panel?

Tabbing from a field to the previous/next by using the shift+tab/tab keys 
were possible in non-dialog windows when using a panel.


Should the wxTAB_TRAVERSAL style be used for beeing able to do this, and 
the previous way was just a helpful bug?


Or wxTAB_TRAVERSAL should be used for another efect?

Thanks.

Octavian

- Original Message -
From: Mark Dootsonmark.doot...@znix.com
To:wxperl-users@perl.org
Sent: Monday, June 06, 2011 5:50 PM
Subject: Re: What good is a Wx::Panel?





On 06/06/2011 15:43, Shawn H Corey wrote:

On 11-06-06 10:25 AM, Mark Dootson wrote:

My tip would be to always use a Wx::Panel within the Wx::Frame. If you
don't, you will get unexpected and annoying differences in background
drawing between different platforms.


OK, it the anything I _should_ do with the panel?


My standard frame creations look something like:


my $frame = Wx::Frame-new(undef, -1, 'Frame Title');
my $mainpanel = Wx::Panel-new($frame, -1, [-1,-1], [-1,-1],
wxTAB_TRAVERSAL|wxBORDER_NONE);

...
my $childcontrol = Wx::SomeControl-new($mainpanel, ..


my $framesizer = Wx::BoxSizer-new(wxVERTICAL);
$framesizer-Add($mainpanel, 1, wxEXPAND|wxALL, 0);

my $mainsizer = Wx::BoxSizer-new(wxVERTICAL);
$mainsizer-Add($childcontrol, 

$mainpanel-SetSizer($mainsizer);
$frame-SetSizer( $framesizer );



I'm trying to write a simple todo app (like the world needs another 
one)

because it should be simple enough to help me learn WxPerl but complex
enough so I learn something useful.

I think I put my endeavours on the wiki. :)


Excellent idea.









Re: What good is a Wx::Panel?

2011-06-06 Thread Octavian Rasnita
Hi Mark,

Why is wxTAB_TRAVERSAL needed in a panel?

Tabbing from a field to the previous/next by using the shift+tab/tab keys were 
possible in non-dialog windows when using a panel.

Should the wxTAB_TRAVERSAL style be used for beeing able to do this, and the 
previous way was just a helpful bug?

Or wxTAB_TRAVERSAL should be used for another efect?

Thanks.

Octavian

- Original Message - 
From: Mark Dootson mark.doot...@znix.com
To: wxperl-users@perl.org
Sent: Monday, June 06, 2011 5:50 PM
Subject: Re: What good is a Wx::Panel?


 
 
 On 06/06/2011 15:43, Shawn H Corey wrote:
 On 11-06-06 10:25 AM, Mark Dootson wrote:
 My tip would be to always use a Wx::Panel within the Wx::Frame. If you
 don't, you will get unexpected and annoying differences in background
 drawing between different platforms.

 OK, it the anything I _should_ do with the panel?
 
 My standard frame creations look something like:
 
 
 my $frame = Wx::Frame-new(undef, -1, 'Frame Title');
 my $mainpanel = Wx::Panel-new($frame, -1, [-1,-1], [-1,-1], 
 wxTAB_TRAVERSAL|wxBORDER_NONE);
 
 ...
 my $childcontrol = Wx::SomeControl-new($mainpanel, ..
 
 
 my $framesizer = Wx::BoxSizer-new(wxVERTICAL);
 $framesizer-Add($mainpanel, 1, wxEXPAND|wxALL, 0);
 
 my $mainsizer = Wx::BoxSizer-new(wxVERTICAL);
 $mainsizer-Add($childcontrol, 
 
 $mainpanel-SetSizer($mainsizer);
 $frame-SetSizer( $framesizer );
 

 I'm trying to write a simple todo app (like the world needs another one)
 because it should be simple enough to help me learn WxPerl but complex
 enough so I learn something useful.

 I think I put my endeavours on the wiki. :)
 
 Excellent idea.
 
 



Re: Forcing a Look 'n' Feel

2011-04-11 Thread Octavian Rasnita
From: Jon Aykroyd three1...@gmail.com
 Hal,
 
 I know this is a wxperl group, but hasn't you given any thought to a web
 basted application?  That way the customer doesn't have to download a client
 for their computer, and you only have to maintain one code base, not to
 mention the inherent problems of installing and running perl across
 multiple  different versions of windows/*nix.

Yes, you are perfectly right.

 I hope I don't get flamed for recommending a non-wxPerl solution on the
 wxPerl mailing list; in my opinion it would be easier and more efficient to
 use, build, maintain, and deploy, mod_perl, FastCGI, or even the standard
 CGI modules (depending on server load), then to deploy your solution to each
 individuals desktop, laptop, etc.


Also agree, but not with the word use.

It is not as simple to use a web app as a desktop app, because the web controls 
are much more limited, the web interface is not as accessible from the keyboard 
as a desktop GUI, and the accountants always prefer a desktop app. :-)

The web is the best in most cases, but not always...

Octavian



Re: Forcing a Look 'n' Feel - Cava :-)

2011-04-11 Thread Octavian Rasnita
From: jeff j...@roqc.no
 Cava  Citrusperl are the way to go.  Mark has taken care all of the
 Perl builds on all platforms, the packaging on all platforms and now
 even the installer. All you do is write code and feed it in.  :-)
 
 Jeff


Can it create packages for all platforms under a certain platform? (For example 
if it is used under Windows, can it also create packages for Linux and Mac?)

What's the advantage over PDK? Does it have a CLI interface?

Thanks.

Octavian



Wx::AcceleratorTable can't handle Escape and EVT_CHAR is not handled by all form objects

2011-03-18 Thread Octavian Rasnita
Hi,

Wx::AcceleratorTable doesn't handle the Escape key under Windows, so an 
EVT_CHAR event must be defined for every form field.

But I've seen that the event EVT_CHAR is not handled by all form objects, for 
example the buttons doesn't handle it.

Is there another way to define the Escape key as an accelerator that can be 
accessed anywhere in the application?

Or it is a limitation of wxWIDGETS or WxPerl? Or a bug?

Thanks.

--Octavian


Re: Wx::AcceleratorTable doesn't work

2011-03-17 Thread Octavian Rasnita

From: Johan Vromans jvrom...@squirrel.nl

Octavian Rasnita orasn...@gmail.com writes:


Hi,

I have tried to define an accelerator for a button, then I've seen that 
the accelerator for menu items work on more platforms so I've tried to 
define an accelerator for a menu item, but it still doesn't work.


I've defined the menu item:

$self-{FileStop} = $self-{FileMenu}-Append(-1, t(Stop\tEsc));

#... then the accelerator:
my $accelerator = Wx::AcceleratorTable-new
  ([wxACCEL_NORMAL, WXK_ESCAPE, $self-{FileStop}]);
$self-SetAcceleratorTable( $accelerator );


The 3rd arg needs to be a command id.
$self-{FileStop} contains the boolean result from appending the menu
item.



Aha, I understand. I thought that the third item must be the ID of the menu 
item.
(But I think the ID of the menu item is returned by the Append() method, 
because I can use that value when defining events for it.)


Please tell me how to get the ID of the command that should execute a 
certain function.
I've seen only examples when Escape is used for closing a window, but I need 
it for executing a certain function.


Thanks.

Octavian



EVT_CHAR needs to be defined for every control?

2011-03-17 Thread Octavian Rasnita
Hi,

I thought that if I define an EVT_CHAR event handler for a form is enough, and 
that event will appear each time a key is pressed, no matter which control on 
that form has the focus:

EVT_CHAR($self, \OnChar);

sub OnChar {
my ( $self, $event ) = @_;
die OnChar;
}

But if there are some controls on the form and one of them has the focus in a 
certain moment, the function OnChar is not called.
If I comment out all the controls definitions and the form remains empty, that 
function is called.

I've seen that if I define an event handler for each controls on the form, the 
event handler works when a certain control has the focus:

EVT_CHAR($self-{TextField}, \OnChar);

But... is this the way it should be? Isn't there something wrong?
I found a little strange that the form's event handler EVT_CHAR is not working 
if there are controls on the form and that I need to define this event handler 
for all the form elements.

Thanks.

Octavian



Re: EVT_CHAR needs to be defined for every control?

2011-03-17 Thread Octavian Rasnita
From: Mattia Barbon mattia.bar...@libero.it
 On 17/03/11 20.34, Octavian Rasnita wrote:
 
   Hi,
 
 I thought that if I define an EVT_CHAR event handler for a form is enough, 
 and that event will appear each time a key is pressed, no matter which 
 control on that form has the focus:
 

   wxKeyEvent does not derive from wxCommandEvent, so it is only sent to 
 the control generating the event (like wxMouseEvents), hence this is the 
 expected behavior.
 
 Regards,
 Mattia


Ok, thank you. In that case, is there another way of defining an event handler 
for the entire form that detects when the Escape key is pressed?

It seems that Wx::AcceleratorTable works, but at least under Windows it doesn't 
detect the key combinations that include the Escape key.

Thank you.

Octavian



Wx::AcceleratorTable doesn't work

2011-03-16 Thread Octavian Rasnita
Hi,

I have tried to define an accelerator for a button, then I've seen that the 
accelerator for menu items work on more platforms so I've tried to define an 
accelerator for a menu item, but it still doesn't work.

I've defined the menu item:

$self-{FileStop} = $self-{FileMenu}-Append(-1, t(Stop\tEsc));

#... then the accelerator:
my $accelerator = Wx::AcceleratorTable-new([wxACCEL_NORMAL, WXK_ESCAPE, 
$self-{FileStop}]);
$self-SetAcceleratorTable( $accelerator );

Instead of WXK_ESCAPE I have also tried the integer 27 but with no results.

I want that accelerator to push a button or execute a menu item when pressing 
escape.

I thought that \tEscape string in the menu item definition might create 
conflicts, and I have also tried to name it Esc or Escap, but with no 
results.

If I execute manually that menu item, it works as it should.

Am I missing something from the accelerator definition or what can be the 
problem?

Thanks.

Octavian



Wx::Gauge in status bar

2011-02-20 Thread Octavian Rasnita
Hi,

I have a status bar with 2 fields and I want to add a Wx::Gauge progress bar in 
the second field after pressing a button (in the click event of that button).

I have read that 
It is possible to create controls and other windows on the status bar. 
Position these windows from an OnSize event handler.

Does anyone know how to do this? I didn't find an example in the Wx::Demo nor 
after searching with Google.

I know how to add text to the second field of the status bar, but I don't know 
how to create the Wx::Gauge object there.

Thanks.

Octavian



Key combination detection in WxPerl

2011-01-02 Thread Octavian Rasnita
Hi and I wish you a happy new year,

Regarding the detection of hotkeys in a WxPerl application, please tell me 
which keys can be detected.

I have seen that I can't detect when the Alt key is pressed.

I am interested which of the following keys can be detected when they are 
pressed together with a letter or number or F1-F12 key:
- Control
- Alt
- Shift
- Insert
- WindowsKey

Thank you.
--Octavian


Re: Error when LWP, WxPerl and version.pm are used together

2010-12-06 Thread Octavian Rasnita
Hi Mark,

Thank you for that solution. It works fine.

Yes, probably the problem is the replace of UNIVERSAL::VERSION, because if I 
redefined that subroutine, the program also works:

sub UNIVERSAL::VERSION {}

Thanks.

Octavian

- Original Message - 
From: mdootson mdoot...@cpan.org
To: Octavian Rasnita orasn...@gmail.com
Cc: wxperl-users@perl.org; jpeac...@cpan.org
Sent: Sunday, December 05, 2010 5:19 PM
Subject: Re: Error when LWP, WxPerl and version.pm are used together


 Hi Octavian,
 
 I think you can 'fix' this by an explicit 'use' for IO::Socket.
 
 e.g.
 
 use IO::Socket 1.31;
 
 should prevent the problem.
 
 For info, this only seems to be a problem with Perl 5.10 - it does not 
 happen in Perl 5.12
 
 I don't know why the problem exists - probably something to do with 
 version.pm replacing UNIVERSAL::VERSION.
 
 Hope the fix helps anyway
 
 Regards
 
 Mark
 
 
 
 On 05/12/2010 09:36, Octavian Rasnita wrote:
 Hi,

 Here below I added a sample program that gives an error if WxPerl, LWP and 
 version.pm are used together.

 The program works fine if either
 - With Wx::Locale I use the language id 56 (for English) instead of 155 (for 
 Romanian) or
 - instead of use version; I use use version();.

 The first problem is that I need to localize a WxPerl app and I also need to 
 be able to use the Romanian language and the second problem is that I use 
 REST::Google::Translate which uses use version; (without quotes.

 The program gives the error 501 Attempt to reload IO/Socket.pm aborted. on 
 the line:
 die $response-status_line unless $response-is_success;

 After version.pm is loaded by REST::Google::Translate I have tried to use a 
 no version; and I have also tried to redefine all the subroutines it 
 exports for not polluting too bad the current namespace, but without results.

 LWP is somehow affected by the combination of version.pm and the use of the 
 language id for Romanian in Wx::Locale, but I don't know what's the problem.
 All the 3 modules use XS code so it might be complicated...

 Please tell me if there is a solution for this problem, or at least a 
 workaround which is more clean than modifying REST/Google/Translate.pm.

 I am using LWP::UserAgent 5.835, WxPerl 0.98, version 0.86 with ActivePerl 
 5.10.1 build 1007 under Windows XP Pro.

 Thank you very much.

 Here is the test program:

 use strict;
 use Wx ':everything';
 use Wx::Locale gettext =  '_t';
 use LWP::UserAgent;
 use version;

 my $locale = Wx::Locale-new(155); #gives errors
 #my $locale = Wx::Locale-new(56); #works fine with this line

 my $ua = LWP::UserAgent-new;

 my $request = HTTP::Request-new( GET =  'http://www.google.com/');

 my $response = $ua-request( $request );

 die $response-status_line unless $response-is_success;

 print $response-content;


 Octavian




Error when LWP, WxPerl and version.pm are used together

2010-12-05 Thread Octavian Rasnita
Hi,

Here below I added a sample program that gives an error if WxPerl, LWP and 
version.pm are used together.

The program works fine if either
- With Wx::Locale I use the language id 56 (for English) instead of 155 (for 
Romanian) or
- instead of use version; I use use version();.

The first problem is that I need to localize a WxPerl app and I also need to be 
able to use the Romanian language and the second problem is that I use 
REST::Google::Translate which uses use version; (without quotes.

The program gives the error 501 Attempt to reload IO/Socket.pm aborted. on 
the line:
die $response-status_line unless $response-is_success;

After version.pm is loaded by REST::Google::Translate I have tried to use a no 
version; and I have also tried to redefine all the subroutines it exports for 
not polluting too bad the current namespace, but without results.

LWP is somehow affected by the combination of version.pm and the use of the 
language id for Romanian in Wx::Locale, but I don't know what's the problem.
All the 3 modules use XS code so it might be complicated...

Please tell me if there is a solution for this problem, or at least a 
workaround which is more clean than modifying REST/Google/Translate.pm.

I am using LWP::UserAgent 5.835, WxPerl 0.98, version 0.86 with ActivePerl 
5.10.1 build 1007 under Windows XP Pro.

Thank you very much.

Here is the test program:

use strict;
use Wx ':everything';
use Wx::Locale gettext = '_t';
use LWP::UserAgent;
use version;

my $locale = Wx::Locale-new(155); #gives errors
#my $locale = Wx::Locale-new(56); #works fine with this line

my $ua = LWP::UserAgent-new;

my $request = HTTP::Request-new( GET = 'http://www.google.com/');

my $response = $ua-request( $request );

die $response-status_line unless $response-is_success;

print $response-content;


Octavian



Strange error locale dependent

2010-12-03 Thread Octavian Rasnita
Hi,

I have made a program that translates the text using Google's translation 
services and it also uses Wx::Locale.

If the interface of the program is in English, the program works fine. If I 
change the language_id of the current language of the interface in the config 
file to 155 (Romanian), then the program gives an error:

HTTP request failed: 501 Attempt to reload IO/Socket.pm aborted.
Compilation failed in require at E:/lucru/lib/Translate/Translator.pm line 26

At line 26 there is the following:

my $gt = REST::Google::Translate-new(
  q = $chunk,
  langpair = $self-source_language . '|' . $self-destination_language,
);

I verified and these variables are well initialized.

I've also seen that after changing the current locale to Romanian, when I 
printed the version of the application in the About window (0.03), this version 
was also localized to 0,03. This is fine, but I am wondering if this 
localization of numbers doesn't effect other programming code making it not 
work well.

Is there a way to specify that I want to just translate the strings specified 
in the .mo files, but without localizing other things? Or it may be another 
problem?

Thanks.

Octavian



Modal frame?

2010-11-30 Thread Octavian Rasnita
Hi,

I have created a frame with WxPerl and I want to open it as a modal window. Is 
it possible with WxPerl?

Can I open it somehow as a dialog window that can be opened in modal mode?

Thanks.

Octavian



Detecting the key combinations

2010-11-26 Thread Octavian Rasnita
Hi,

In an event handler of a text field I try to get and print (for testing) the 
key code and the modifiers using something like:

sub OnKeyCombinations {
  my ($key_combination, $event) = @_;

  my $key = $event-GetKeyCode;
  my $modifiers = $event-GetModifiers;

$key_combination-SetValue(key: $key, mod: $modifiers);
}

There are 2 problems. One is the fact that the Alt key is not detected at all 
with this code, and the other one is that the key code is changed if the 
Control key is used and I don't know how to find the real key pressed.

For example, here are the key pressed, and the results:

p: key: 112, mod: 0
Shift+p: key: 80, mod: 4
Control+p: key: 16, mod: 2
Control+Shift+p: key: 16, mod: 6
Alt+p: no change, a short beep because there is no accelerator key defined as 
Alt+p, the keypress is not detected)
Control+Alt+p: (no change, no beep, the keypress is not detected)

The modifiers are detected correctly if I use only Control and Shift. They give 
the result 2, 4 and 6 but the Alt key is not detected although it should be.

The key code changes if I press the Control key from 80 to 16 and I don't know 
how to find the pressed key if the Control modifier was pressed.

I have also put a die() in this event handler but the program doesn't break if 
I use a key combination that contains the Alt key, so it is obviously not 
detected.

In WxPerl manual I read:

Note for Windows programmers: The key and char events in wxWidgets are similar 
to but slightly different from Windows WM_KEYDOWN and WM_CHAR events. In 
particular, Alt-x combination will generate a char event in wxWidgets (unless 
it is used as an accelerator).

I use ActivePerl 5.10.1 under Windows XP and WxPerl 0.98.

Am I missing something or doing something wrong?

Thanks.

Octavian



Can't subclass Wx::Frame using parent.pm?

2010-11-13 Thread Octavian Rasnita
Hi,

I have tried:

package Package::Name;
use strict;
use warnings;
use Wx ':everything';
use parent 'Wx::Frame';

It gives the following error:

Can't locate Wx/Frame.pm in @INC (@INC contains: E:/usr/site/lib E:/usr/lib .) 
at E:/usr/lib/parent.pm line 20.
BEGIN failed--compilation aborted at E:\work\lib\Package\Name.pm line 7.

The program doesn't giv the error if I use instead:

use base 'Wx::Frame';

Is there anything in base.pm which is needed by WxPerl but it isn't offered by 
parent.pm?

Thanks.

Octavian



Re: Can't subclass Wx::Frame using parent.pm?

2010-11-13 Thread Octavian Rasnita
From: Johan Vromans jvrom...@squirrel.nl
 Octavian Rasnita orasn...@gmail.com writes:
 
 use parent 'Wx::Frame';

 It gives the following error:

 Can't locate Wx/Frame.pm in @INC (@INC contains: E:/usr/site/lib E:/usr/lib 
 .) at E:/usr/lib/parent.pm line 20.
 BEGIN failed--compilation aborted at E:\work\lib\Package\Name.pm line 7.
 
 ...
 
 Is there anything in base.pm which is needed by WxPerl but it isn't
 offered by parent.pm?
 
 parent.pm insists on loading the module as Wx/Frame.pm, while most Wx
 modules are loaded from other files when you did use Wx.

Oh yes, Wx uses a strange design and I have forgotten that this could be a 
problem. :-)

 base.pm seems to be much smarter.
 
 You can get the desired behaviour by using 
 
  use parent -norequire, 'Wx::Frame';
 
 (Which I consider an ugly hack...)

Yes you're right. Better using 'base.pm'...

Thank you.

Octavian



Wx and PDK

2010-11-08 Thread Octavian Rasnita
Hi,

The programs created with Wx don't need to use Wx::Perl::Packager and the 
script wxpdk for creating PDK executables for Windows anymore?

I have a problem with a program that uses Pod::Constants but I can't add it to 
the executable even though I've tried with --add Pod::Constants parameter. Is 
there another way to do it? (The executable gave an error telling that 
Pod::Constants can't be found...)

Thanks.


Octavian



Re: Screensaver on touch screen

2010-09-23 Thread Octavian Rasnita

In that case it might be impossible.
It may be like when you turn off the computer display and start clicking 
with the mouse.


The computer doesn't know if the display is on or off so it reacts to the 
clicks.
But if that touch pad works that way and doesn't know when the display is 
turned off, it means that it was not designed very well, exactly for the 
problems you found.


--Octavian

- Original Message - 
From: Johan Vromans jvrom...@squirrel.nl

To: wxperl-users@perl.org
Sent: Thursday, September 23, 2010 8:26 AM
Subject: Re: Screensaver on touch screen



Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de writes:


Why don't you write a screen saver that does something like this?:
Create a new window that covers the whole screen, then immediately start 
a

real screen saver. Exit on the first click/keystroke recieved.


I'm not even sure there's a screensaver program involved. The screen is
blanked, that's the only thing I know.

-- Johan 




WxPerl and Moose

2010-09-12 Thread Octavian Rasnita
Hi,

Can WxPerl be used with Moose?

I have tried the following test program:

package WxTrial;

use Moose;
use Wx;

extends 'Wx::SimpleApp';

1;

package main;

#my $t = WxTrial-new;

my $t = WxTrial-new(foo = bar);

The program gives the following error if I use it with the parameter foo = 
bar:

sub must be a CODE reference at E:/usr/site/lib/Wx/App.pm line 36.

It doesn't give any error if I don't use any parameter with the new();

Thanks.

Octavian



Re: Subclassing an empty class?

2010-08-08 Thread Octavian Rasnita
From: Mattia Barbon mattia.bar...@libero.it
 Octavian Rasnita wrote:
 
   Hi,
 
 Thank you for this solution. It works. However, I just found a bug in 
 another program I made that was caused by re-blessing an object and I am 
 afraid that this re-blessing might cause problems in the future and I might 
 need to redesign the app.
 
   Could you elaborate on what the bug was?  If there is a problem with 
 the workaround I proposed, there will be the same bug when the solution 
 is implemented (without reblessing) in wxPerl.
 
 Regards,
 Mattia


Sorry for not beeing clear enough, but that bug I found appeared in a program 
that has nothing to do with Wx.
I just wanted to tell that I am a little afraid to rebless the objects. :-)

Octavian



Re: AW: Distributing wxPerl applications - Perlapp

2010-08-03 Thread Octavian Rasnita
Yes I know that the executables created with perlapp or P'AR don't need Perl 
on the machines they are running on, but I am talking about the development 
machine, not the target machine.


--
Octavian

- Original Message - 
From: perltk per...@maine.rr.com

To: wxperl-users@perl.org
Sent: Tuesday, August 03, 2010 2:44 PM
Subject: Re: AW: Distributing wxPerl applications - Perlapp


The point of perlapp is that you don't even need perl installed on 
machines where app runs.  So you can have a different verison(s) of perl 
installed and the standalone will completely ignore them.  Like PAR, it 
builds its own distro in a temp directory and the search path is set to 
that.  You can alos modify the PERL5LIB with the builder or on the fly in 
your app if need to.


My perlapp experience so far::
linux, Windows: Perl Tk works great.   Wxperl - just getting started
Mac :   Wxperl Limited success.  Ended up building an  '.App' package with 
shell script - worked fine


OSX comes with wxperl installed, by the way.



On 8/3/2010 4:08 AM, Octavian Rasnita wrote:

Thank you for clarifications.

I haven't even tried to use perlapp with Strawberry because I thought 
that they are not compatible.


The Perl distro we use is important (in my opinion) because I prefer to 
have just a single Perl distro installed on a machine, and because I use 
that distro for running WxPerl apps, Catalyst apps, mod_perl  and other 
modules, and for some things Strawberry works better.


For example, I am not able to install the latest Padre under ActivePerl.

Of course, Strawberry has its own issues so I am trying to find the best 
solution.


--
Octavian

- Original Message - From: Jan Dubois j...@activestate.com
To: 'Octavian Rasnita' orasn...@gmail.com; 'ademmler' 
n...@ademmler.com; 'Johan Vromans' jvrom...@squirrel.nl; 'Daniel 
Carrera' dcarr...@gmail.com

Cc: wxperl-users@perl.org
Sent: Tuesday, August 03, 2010 8:59 AM
Subject: RE: AW: Distributing wxPerl applications



PerlApp supports many platforms (AIX, HP-UX, Linux, Mac OS X, Solaris,
Windows), and generally requires a version of Perl that has been
compiled with the same options as ActivePerl. Therefore the
documentation lists the various minimum versions of ActivePerl that are
supported.

The Perl versions distributed by various vendors (Apple, IBM,
Sun/Oracle, Red Hat) are mostly not compatible with ActivePerl and will
therefore not work with PerlApp.

Strawberry Perl however is compiled with the same options as ActivePerl
and is at the core very similar. The differences are more in the
packaging, and in additional stuff that is included in each
distribution.

I know that the standard regression tests for the PDK did pass with the
latest Strawberry Perl releases, so I'm sure it works in general, but
there are always little details that might be different. If we get a
concrete bug report, then we'll try to fix it, if possible with a
reasonable amount of effort.

One feature of PerlApp 9.x that won't work with Strawberry though is the
cross-platform wrapping: you can use ActivePerl and PerlApp on Windows
to build binaries for Linux and OS X. This requires that the local Perl
installation includes PPM4, which is only available in ActivePerl.

One thing is not quite clear to me though: Once you build a standalone
executable with PerlApp you no longer need ActivePerl or Strawberry Perl
on the deployment system (that is kind of the point of the whole 
exercise),

so why does it matter if you build with one vs. the other?

Cheers,
-Jan


On Mon, 02 Aug 2010, Octavian Rasnita wrote:


I haven't tried perlapp with Strawberry Perl, but if I remember well I 
read
somewhere that PDK only works with ActivePerl. Maybe the announcement 
made

by ActiveState wasn't clear.

It was something like PDK version X only works with ActivePerl version 
X
and above. Maybe it should have been works with Perl X and above 
but
I am not so sure because I think I also remember that I've read 
explicitly

that PDK requires ActivePerl.

Isn't this true?

--
Octavian

- Original Message -
From: Jan Dubois j...@activestate.com
To: 'ademmler' n...@ademmler.com; 'Johan Vromans'
jvrom...@squirrel.nl; 'Daniel Carrera' dcarr...@gmail.com
Cc: wxperl-users@perl.org
Sent: Tuesday, August 03, 2010 1:12 AM
Subject: RE: AW: Distributing wxPerl applications


 On Mon, 02 Aug 2010, ademmler wrote:

 hi,

 I am using all of those tools and the major difference is the
concept
 behind:

 B) ActiveStae perlapp I could not run wtihout ActiveStae Per . . .
 (non strawberry)

 Could you provide me with a sample that fails?  PerlApp generally
works
 fine with Strawberry Perl, but I haven't tested it with Strawberry
and
 wxPerl.

 Ideally I would like to know:

 * Exact version of Strawberry Perl
 * How you built/installed wxPerl (and which version)
 * Version of the PDK (`perlapp --version --verbose` output)
 * Small sample script
 * Did you use Wx::Perl::Packager (which version)
 * Commandline used

Re: AW: Distributing wxPerl applications

2010-08-02 Thread Octavian Rasnita

Hi,

On Cava's web site I read:

Cava Packager provides a packaging solution for applications developed in 
Perl on the Windows, Linux and MacOSX platforms..


So it seems that it should work for Mac and Linux also...

I have also read:

...At your option you can 'encrypt' the source code of distributed modules 
and run them using an included decrypting source filter.


So it can also allow source code encryption.

Are these things true?

--
Octavian

- Original Message - 
From: ademmler n...@ademmler.com
To: Johan Vromans jvrom...@squirrel.nl; Daniel Carrera 
dcarr...@gmail.com

Cc: wxperl-users@perl.org
Sent: Monday, August 02, 2010 11:39 PM
Subject: Re: AW: Distributing wxPerl applications



hi,

I am using all of those tools and the major difference is the concept 
behind:


A) perl2exe never made it succsesfully for me.

B) ActiveStae perlapp I could not run wtihout ActiveStae Per . . .  (non 
strawberry)


C) PAR  is generating some ZIP Archive containing everything. While 
launch this one is unpacked to some tmp directory.
Par can encode the files and changes the file names (to some fancy 
longish names).
par runs on any plattform, but have some cave eats. One trick add sth. 
like this to the end of your code if the module wont be included 
propperly.


sub _par_hints {

require module::name;
}

D) Cava builds an APP folder containing all files and libs needed in 
open formats.
also the UI is perfect and it is easy to maintin a distribution. Also  you 
can include resources and make an installer with Cava.
In my view Cava is more structured, better file collection and more 
robust - actually  onyl on windows.



So I am looking forward to get Cava Also for Linux and Mac OS X :)

Alexander

Am 02.08.2010 um 22:24 schrieb Johan Vromans:


Daniel Carrera dcarr...@gmail.com writes:


Does Cava work better than PAR? How would you compare them? What's  the
ETA for Cava to be cross-platform?

I don't have any urgency. I am not a commercial developer with a 
deadline.


Then I suggest you repeat this question in a couple of weeks when (I
assume) the Cava developer will be back from vacations.

-- Johan



__ Information from ESET NOD32 Antivirus, version of virus 
signature database 5335 (20100802) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com






__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5335 (20100802) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





Dependency on latest alien::wxWIDGETS

2010-07-26 Thread Octavian Rasnita
Hi,

I found that Wx gives some errors after I installed it with ppm from WxPerl 
repository.
I've seen that it required the latest version of alien::wxWIDGETS. After I 
installed this module with ppm, Wx started to work fine.

It could be helpful to put a dependency on the latest version of 
alien::wxWIDGETS for Wx for installing alien::wxWIDGETS automaticly if the 
latest version is not installed. 

Thanks.

--
Octavian



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5315 (20100726) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



perl.exe - Unable To Locate Component

2010-07-24 Thread Octavian Rasnita
Hi,

I've just installed the latest version of Wx under Windows XP Pro:

ppm s Wx

...
3: Wx
Interface to the wxWidgets cross-platform GUI toolkit
Version: 0.9702
Repo: wxperl
C:\Documents and Settings\Octavianppm inst 3
Downloading Wx-0.9702...done
Unpacking Wx-0.9702...done
Generating HTML for Wx-0.9702...done
Updating files in site area...done
111 files installed
C:\Documents and Settings\Octavianperl -MWx 888 -e1
Can't load 'E:/usr/site/lib/auto/Wx/Wx.dll' for module Wx: load_file:The 
specified module could not be found at E:/usr/lib/DynaLoader.pm line 201.
at -e line 0
Compilation failed in require.
BEGIN failed--compilation aborted.
C:\Documents and Settings\Octavian

(But the file Wx.dll is there on the specified location.)

In adition, the following error window appears:

perl.exe - Unable To Locate Component
This application has failed to start because wxbase28u_gcc_wxp_binary_11_6.dll 
was not found. Re-installing the 
application may fix this problem. 
OK

Of course I have tried to reinstall Wx but without any change.

I use ActivePerl 5.10.1 build 1007 under Windows XP Pro and the URL to the 
WxPerl ppm repository configured in PPM is:

http://www.wxperl.co.uk/repository/package.xml

I have Visual Studio 6 installed.

Can you tell me what could I do to make it work?

Thanks.

Octavian



Re: Padre can't be installed from WxPerl repository?

2010-04-27 Thread Octavian Rasnita
Thanks Mark. I think the Padre installation issues might have something to do 
with the fact that I use Visual Studio 6 as a C compiler if you say that you 
were able to install Padre with build 1007.

I have also tried Komodo, but unfortunately it is not very accessible for a 
screen reader.

Octavian

- Original Message - 
From: Mark Dootson mark.doot...@znix.com
To: Octavian Rasnita orasn...@gmail.com
Cc: wxperl-users@perl.org
Sent: Tuesday, April 27, 2010 3:16 PM
Subject: Re: Padre can't be installed from WxPerl repository?


 Octavian,
 
 I just tried
 
 cpan Padre
 
 on ActivePerl build 1007 for 32 bit Windows.
 
 It all installed OK.
 
 Using it successfully is a different matter. I've never managed to step 
 through code using Padre with ActivePerl. As I'm a Komodo and PDK user, 
 there are a few things to alter regarding Perl debugging before Padre 
 can have a chance of working. I think the information is in the PDK 
 documentation. But it always falls over with some Term::Readline errors. 
 I've always assumed this is just my setup and a failure to reset the 
 debug environment properly as there must be some testing done on the 
 Padre team using ActivePerl and I don't really have the time to 
 investigate further.
 
 So, I think your cpan install problems may be specific to your setup
 
 Regards
 
 Mark
 
 
 
 
 On 27/04/2010 10:28, Octavian Rasnita wrote:
 Thank you Mark,

 After moving padre, padre.exe and padre.bat in the perl/bin directory
 the editor works if I start it with padre.exe.

 It doesn't work if I execute padre.bat.

 I have tried to install it using cpan after installing it with ppm (for
 installing its dependencies) and after I removed it with `ppm remove
 Padre`, but I still can't install it with cpan. It gives some strange
 and unclear errors.

 --
 Octavian

 - Original Message - From: Mark Dootson mark.doot...@znix.com
 To: Octavian Rasnita orasn...@gmail.com
 Cc: wxperl-users@perl.org
 Sent: Tuesday, April 27, 2010 2:32 AM
 Subject: Re: Padre can't be installed from WxPerl repository?


 Hi,

 I think that's an issue with Padre 0.56 as installed by PPM.
 The command

 padre.bat

 should work. Alternatively, you could move padre.exe, padre.pl and
 padre.bat from ..perl\site\bin to ..\perl\bin

 One thing you might like to try. I think that as you will now have
 most of the pre-requisites installed, if you have a compiler I don't
 see why

 cpan Padre

 would not work for you. It might be an idea to uninstall the Padre PPM
 first.

 Regards

 Mark


 On 26/04/2010 20:51, Octavian Rasnita wrote:
 Hi Mark,

 From: Mark Dootsonmark.doot...@znix.com
 Hi,

 I tested ActivePerl 1007 Padre install and it seemed to work OK.

 Perhaps the repository needs re-sync

 ppm repo sync --force wxperl

 ppm s Padre


 Regards

 Mark


 Thank you. I was able to install Padre.
 Unfortunately when I try to run it, it displays the following error
 window:

 Padre
 Cannot find 'WPerl.exe'!
 OK

 There is no WPerl.exe, but there is wperl.exe in the bin
 directory of ActivePerl and I guess it should work because under
 Windows the case differences shouldn't matter.

 Do you have any idea what could be the problem? Padre? ActivePerl?

 Thanks.

 Octavian



 __ Information from ESET NOD32 Antivirus, version of virus
 signature database 5063 (20100426) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com





 __ Information from ESET NOD32 Antivirus, version of virus
 signature database 5064 (20100427) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com






Padre can't be installed from WxPerl repository?

2010-04-26 Thread Octavian Rasnita
Hi,

I've seen that Padre can't be installed under ActivePerl 5.10.1 using cpan, so 
I've tried to install it from WxPerl repository using:

C:\Documents and Settings\Octavianppm s Padre
...
3: Padre
Perl Application Development and Refactoring Environment
Version: 0.56
Repo: wxperl
C:\Documents and Settings\Octavianppm inst 3
Downloading Padre-0.56...not found
ppm inst failed: 404 Not Found
C:\Documents and Settings\Octavian

Is there something wrong with WxPerl repository?
I've tried to install Padre from it because it is the newest version offered in 
ppm format.

Thanks.

Octavian



Re: Padre can't be installed from WxPerl repository?

2010-04-26 Thread Octavian Rasnita
Hi Mark,

From: Mark Dootson mark.doot...@znix.com
 Hi,
 
 I tested ActivePerl 1007 Padre install and it seemed to work OK.
 
 Perhaps the repository needs re-sync
 
 ppm repo sync --force wxperl
 
 ppm s Padre
 
 
 Regards
 
 Mark


Thank you. I was able to install Padre.
Unfortunately when I try to run it, it displays the following error window:

Padre
Cannot find 'WPerl.exe'!
OK

There is no WPerl.exe, but there is wperl.exe in the bin directory of 
ActivePerl and I guess it should work because under Windows the case 
differences shouldn't matter.

Do you have any idea what could be the problem? Padre? ActivePerl?

Thanks.

Octavian



Re: Documentation?

2009-07-31 Thread Octavian Rasnita

From: Roode, Eric ero...@barrack.com

People always rave about wxPython. What's lacking in Perl's wx
implementation?


Yes, why is it considered normal to write a GUI app in python, but
people look at you weird when you suggest doing a GUI app in Perl?

Perl is great for database access and manipulation, it's great for
file manipulation and network programming.  It makes no sense that
most people seem to think that these features can/should only be
accessed from the command line.

-

WxPython seems to have a little more features than WxPerl, but I don't think
this is the main reason it is more used than WxPerl.

Python is prefered these days not only because of its syntax (Which I don't
like it at all for objective reasons), but because it supports much better
the features of the operating systems that use a GUI.

I can use a good screen reader under Windows made with Python (NVDA) and
there is a screen reader made with Python for Linux also (Orca).

I don't even know what could I start with if I would like to make a screen
reader with Perl.
I would probably need to use Win32::API and learn to do pretty low level 
calls to the methods from some .dll files, and learn this from MSDN site...


It is also very important to use threads in a app that uses a GUI, and I
don't know how easy is to use threads under Python, but under Perl is not
very easy, and the apps that use threads consume very many resources.

I don't know if the type of application I tried to do with WxPerl would work 
better with WxPython, but it would surely work better with other languages 
like C++/MFC or even DotNet or Java.


Octavian




Re: Documentation?

2009-07-31 Thread Octavian Rasnita

From: Steffen Mueller nj88ud...@sneakemail.com
Anyhow. When I wrote a lengthy post on use.perl.org about Perl threads, 
it was brought to my attention that very capable people are working on 
making Coros work preemptively. That would -- as far as I can tell -- 
effectively give use Python-like threads. There's still a lot of issues 
to be ironed out, but I'm confident the people who're working on it will 
see this through.


Cheers,
Steffen


Oh, good news! It would be an important step forward for perl.

Octavian



Padre

2008-12-27 Thread Octavian Rasnita

Hi,

I have tried to run the following test program with Padre in order to see if 
the lines are printed on the screen immediately:


$|++;
while (1) {
print ok\n;
sleep 1;
}

The lines are printed immediately on the screen as they should, but the 
problem is that after I have stopped the program, I wasn't able to copy the 
result from the output window to the clipboard, nor to select that text very 
easy, although I don't understand why.
For example, I put the cursor at the bottom of the output window, (because I 
couldn't move the cursor at the top of that window using the keyboard), and 
I pressed Control+Shift+Home which should select the entire content of that 
window.
After doing this, I pressed Control+C to copy that text, but my screen 
reader told me that no text was selected, and of course, it seems that this 
was true, because I couldn't paste it somewhere else.
But if I done Control+Shift+home for 3 times, I was able to copy that text 
to the clipboard. It is very strange why this was possible only after trying 
to select that text for 3 times.


(As a suggestion, it could be helpful if the stop command from the Run menu 
would have a hotkey defined, like Control+Break for example.)


And after I closed the editor which was opened using the padre command in 
the command prompt, and after typing exit command I have seen that the 
command prompt window doesn't want to close.
I have taken a look in Task Manager and I've seen that there was a perl.exe 
process still running, although there was no program using perl in that 
moment.
So I've closed the command prompt window using Control+Pause and then I've 
seen that perl.exe process also ended.


I think Padre doesn't release the perl interpreter when it closes.
Does it use threads that might have not ended?

Thanks.

Octavian



Padre

2008-12-23 Thread Octavian Rasnita

Hi,

I've just installed the editor Padre using cpan, and I have tried to run the 
following script:


use utf8;

binmode STDOUT, :utf8;

print ţâţă de mâţă;

#But when running the program with F5 it prints:
ţâţă de mâţă

...instead of those UTF-8 chars.

Can I do something to make it print the correct chars?

Thank you for creating those hotkeys for moving the cursor in the output 
window and in the main window.


I needed to force install it with cpan, because it gave an error (under 
Windows XP), but it seems to work fine.


Thanks.

Octavian



Re: Kephra 0.4 release

2008-11-29 Thread Octavian Rasnita

From: herbert breunung [EMAIL PROTECTED]

Dear List Member,
I'm very pleased to announce Kephra 0.4


Congratulations for the program!

If it helps you, I have a few things to report after a very short test.

I've seen that I can't change the active document using the keyboard only 
because Control+Tab key is used for other things and it doesn't allow 
changing the active tab this way.

F6 or Control+F6 doesn't work for this task either.

If I select a tab using the mouse, I can't move the focus to the document 
area of that tab and nothing happends if I press Tab.


If I select a tab and this way I set the focus to a certain tab title using 
the mouse, and then I want to select another tab using the keyboard, I can't 
do it. The focus doesn't seem to change if I use the left and right arrow 
keys.


If I save a document and then I delete the file from the disk while it is 
opened in the editor, after a few seconds the program asks me if I want to 
reload or ignore it because it was modified.
The problem is that the file was not modified but deleted and it can't be 
reloaded. If I choose to load it again, it keeps asking me this, and after a 
few trials, the program crashes.
I think that if the file is deleted, it should simply ignore this and keep 
the file in the memory only.


After running the active program using F5, I couldn't find any key to move 
the cursor to the output window using the keyboard only.
(So if I can't move the cursor there, I can't read the results with the 
screen reader.)


The Find and Find and replace dialogs have more buttons that don't have any 
label so my screen readers speaks only button for them so I don't know 
what they are used for.


If I open these dialogs and I press the Escape key, they close fine, but if 
I open them then I press tab for more times and set the focus to a button 
from them and then I press Escape, nothing happends and they don't close. So 
I need to move the focus back to an edit field then press Escape in order to 
be able to close them or as an alternative, to press the Close button.


I've found that in order to change the tabs I need to press Control+Page up 
or page down, so this feature is offered, but not in the common Windows way.
Under Windows this feature is automaticly offered by the tab control of Wx, 
and I think it would be a good idea to not disable it by using the standard 
keys of doing this for something else.


Another strange thing is that if I move the mouse cursor over a part of the 
app, it appears a kind of list with elements like Kephra::Doc, 
Kephra::Document and other things, even though it shouldn't appear and I 
don't even know what they are.


Octavian



Re: open a page in a real web browser

2008-11-21 Thread Octavian Rasnita

From: Gabor Szabo [EMAIL PROTECTED]

Padre has a plug-in that can open a page in a web browser:

http://search.cpan.org/dist/Padre-Plugin-ViewInBrowser/

I wonder if there is better way to do it especially from wx?


Try:

Wx::LaunchDefaultBrowser($url);

Octavian



Re: Accessible GUI Applications in Perl

2008-11-10 Thread Octavian Rasnita

From: Mike Schroeder [EMAIL PROTECTED]

I wonder what is the most complex app out there (free or commercial)
written in wxPerl?


I'm not sure if  we are the largest/most complicated wxPerl app out there 
or

not, but we must be up there...


Is the source code of your app public?
I think we are mostly interested in a free source code that the WxPerl users 
might learn from.


Octavian



Re: Accessible GUI Applications in Perl

2008-11-09 Thread Octavian Rasnita
From: bungsuputra linan [EMAIL PROTECTED]
 Yes, I think threads really tend to use more and more memory. I have an
 application, when it runs, it takes 60 MB of memory, and a simple thread
 to check update increases the memory usage to 90 MB. If the user checks
 update once again, it increases to 120 MB.
 
 Then, we tried to use POE::Loop::Wx and we are really happy with it.
 When it checks for update, it increases to 71 MB, and no matter how many
 times a user clicks to check for update, memory usage does not
 increase. 
 
 I hope this can help.
 Best Regards,
 bungsu

Thank you, but well... I couldn't understand how to use POE. I found that 
module pretty strange, but maybe I haven't found a good example...

Octavian



Re: Accessible GUI Applications in Perl

2008-11-08 Thread Octavian Rasnita

From: Gabor Szabo [EMAIL PROTECTED]

There was a recent thread on PerlMonks with the above title
where I suggested the use of wxPerl.

http://www.perlmonks.org/?node_id=722367

I wonder what is really the issue?
How can one make sure that the application s/he is writing
has the accessibility features?

Gabor


Tk and Gtk based applications are not accessible at all for screen readers. 
I heard that Gtk applications are accessible under Linux, but they are not 
under Windows.


Java SWT applications are very accessible because SWT uses native widgets 
but the SWING applications even though they are accessible if using Java 
Access Bridge, the accessibility is poor.


Even though Microsoft takes care about the accessibility more and more, the 
Dot Net interfaces made with Windows Forms are much less accessible than the 
native Win32 widgets used for example by MFC.


The most accessible interfaces are created with MFC and Win32::GUI in perl.

WxPerl interfaces have some widgets very accessible (the most important 
ones) but it also has some inaccessible widgets also.


In order to be accessible, the screen readers should understand the GUI 
used. So if a GUI appears this year and it has the best accessibility 
features ever, it could be absolutely inaccessible if the screen readers 
don't understand it. And the screen readers manufacturers have their 
interests and don't jump immediately to support another interface because 
this requires much effort which can't be recompensed very easy.


When coding in perl, WxPerl is the best choice for creating a GUI, not only 
because it is also portable while Win32::GUI is not, but also because it 
supports UTF-8 and it can be used with other languages than English.


However, the problem of programs with GUIs in perl is that they create very 
huge programs that eat very much memory if the programs are complex and need 
to use threads.
I've just abandoned a program in WxPerl (an RSS reader/Podcast 
reader/TV/Radio listener) because when it had one thread it occupied 40 MB 
of memory, and after adding each new thread, other 40 MB of memory were 
occupied, so at 4 threads it used 160 MB of memory, and I needed to add more 
threads for updating.


I've tried to share as much code as possible between threads, but no good 
result. Because of this reason the app used to run pretty slow and it were a 
little unresponsive and not nice to use, especially with the keyboard.


Win32::GUI based apps are smaller, but it doesn't offer some important 
features, so it can't be used for complex apps.


So unfortunately the best choice for creating a GUI, is not the best for 
everything.
For accessibility under Windows is C++/MFC. For Portability is Java/SWT. For 
the complexity of widgets and accessibility is wxWidgets.
Maybe the apps created with C++ and wxWidgets are also fast and consume less 
resources, but I don't know because I didn't test it.


And by the way, the program PVoice is not accessible for the blind, because 
if I remember well it offers visual features that can't be seen, like 
pictures, so the accessibility for the blind means a totally different thing 
than the one for the deaf.


Octavian



Re: Binding events to methods

2008-08-31 Thread Octavian Rasnita

Hi Mattia,

What would be the advantage after this change?

I often need to use

  EVT_BUTTON( $self, $button, sub { $_[0]-do_foo( $_[1] ) } );

...just because I need to pass some more parameters to the do_foo 
subroutine/method.


Would it be easier to pass parameters from now on somehow?

If it would be possible, I think it could be very helpful if we could use 
something like:


EVT_BUTTON($self, $button, \do_it, $parameter1, $parameter2);

and all the parameters after the subroutine reference to be added as as 
parameters to that subroutine when calling it.


Thanks.

Octavian

- Original Message - 
From: Mattia Barbon [EMAIL PROTECTED]

To: wxperlusers wxperl-users@perl.org
Sent: Sunday, August 31, 2008 2:14 PM
Subject: Binding events to methods



  Hi,
I just checked in a change I planned to do since forever (and
that took 6 lines of code...) that allows binding an event to a
method instead to a subroutine/code reference.  As an example

  EVT_BUTTON( $self, $button, 'do_foo' );

will try to call do_foo as a method; it is more or less
equivalent to

  EVT_BUTTON( $self, $button, sub { $_[0]-do_foo( $_[1] ) } );

Regards,
Mattia 




Wx::Thread

2008-08-31 Thread Octavian Rasnita

Hi,

I've found the following in Wx::Thread:

 use threads;
 use threads::shared;
 use Wx;

 my $DONE_EVENT : shared = Wx::NewEventType;

 my $worker = threads-create( \work );

 # create frames, etc
 my $frame = Wx::Frame-new( ... );
 EVT_COMMAND( $frame, -1, $DONE_EVENT, \done );
 $app-MainLoop;

 sub done {
 my( $frame, $event ) = @_;
 print $event-GetData;
 }

 sub work {
 # ... do stuff, create a shared $result value

 my $threvent = new Wx::PlThreadEvent( -1, $DONE_EVENT, $result );
 Wx::PostEvent( $frame, $threvent );
 }

__END__

Well, I've seen that the worker thread is created here before creating the 
frames, and I also read in perldoc perlthrtut that this is recommended, 
because the threads will be smaller this way.


But in the line
 Wx::PostEvent( $frame, $threvent );

I've seen that I need to access $frame, so... shouldn't it be created before 
the thread that could access it?

In this case I think
 my $worker = threads-create( \work );
should be put after the line where the frame is created.

I ask this, because I've seen that my program occupies more than 160 MB of 
RAM when it uses 4 threads, and only 46 MB of RAM when I use a single thread 
and I am trying to make it occupy less.
If I create the threads before creating the frame, the program prints an 
error telling that $frame is undefined (but the occupied memory is still 160 
MB).


So, does it really matter if I create the threads before creating the GUI or 
after?


Thanks.

Octavian



Isn't Wx::SingleInstanceChecker working?

2008-08-29 Thread Octavian Rasnita

Hi,

I have tried to use the following method for disallowing more than one 
instance of the application to run:


sub OnInit {
#...

$self-{instance_checker} = Wx::SingleInstanceChecker-new();
if ($self-{instance_checker}-IsAnotherRunning) {
return 0;
}
}

But it doesn't work and I can open more instances of the program.

In the chm wxWidgets documentation I've read that I need to send a name as a 
parameter of

Wx::SingleInstanceChecker-new();

but if I do that, WxPerl gives an error:

Usage: Wx::SingleInstanceChecker::new(CLASS)

I have also read that this method works under Windows and Linux, so it 
should work, because I use Windows XP.


Octavian



Blocking the app from a secondary thread?

2008-08-29 Thread Octavian Rasnita

Hi,

I've seen that if I try to create a Wx::Dialog from a secondary thread, it 
breaks the app, but if I create a Wx::MessageBox it works fine.
So I tried to use a Wx::GetMultipleChoices. It displays well the dialog and 
it returns well the results, but if another thread tries to update the main 
window, in that moment the application crashes.


I don't know why Wx::GetMultipleChoices doesn't work as well as 
Wx::MessageBox, because they are created the same (without -new().


I see that if I want to block other threads to update the GUI, I must use

wxMutexGuiEnter();
and
wxMutexGuiLeave();

I have tried to use

Wx::MutexGUIEnter();

my @result = Wx::GetMultipleChoices(Message, Title, ['aa','bb','cc']);
print @result\n;

Wx::MutexGUILeave();

but it didn't displayed the dialog and it printed the following error 
message:


Error while autoloading 'Wx::MutexGUIEnter' at Informatos/Server.pm line 84

I think Wx::MutexGUIEnter should work with WxPerl because I haven't seen any 
notice telling that it doesn't work.


I have also read that:

Note that under GTK, no creation of top-level windows is allowed in any 
thread but the main one.


So I assume under Win32 it should work.

This function is only defined on platforms which support preemptive 
threads.


But I don't know, is Win32 such a platform?

If it is, please tell me what am I doing wrong.

Thank you.

Octavian



Re: strange error

2008-08-29 Thread Octavian Rasnita

Thank you,

I've found how to use Wx::MessageBox and Wx::MessageDialog without that perl
interpreter error.

Wx::MessageDialog also gives that error, unless I end with an exit();.

So I use:

my $dialog = Wx::MessageDialog-new($self, t(Are you sure you want to

close the application?), t(Exit), wxYES|wxNO, wxDefaultPosition);


if($dialog-ShowModal() == wxID_YES) {
   $self-Destroy();
   exit;
}

I guess this happends because my app uses threads and I don't know how to
end them even though sometimes I would like to kill them.

If I use $thread-kill(...) the program always ends with an error.

Octavian

- Original Message - 
From: bungsuputra linan [EMAIL PROTECTED]

To: wxperl-users wxperl-users@perl.org
Sent: Friday, August 29, 2008 9:38 AM
Subject: Re: strange error



Hi Octavian Rasnita,

I usually use MessageDialog instead of MessageBox for similar case.

So, my suggestion is as follow:

my $dialog = Wx::MessageDialog-new($self, t(Are you sure you want to
close the application?), t(Exit), wxYES|wxNO, wxDefaultPosition);
if($dialog-ShowModal() == wxID_YES) {
  $self-Destroy();
}


On Tue, 2008-08-26 at 17:25 +0300, Octavian Rasnita wrote:

Hi,

I made an app with a menu that has an Exit item which if clicked, it is
handled by the following event handler:

sub OnExit {
my ($self, $event) = @_;

my $result = Wx::MessageBox(t(Are you sure you want to close the
application?), t(Exit), wxYES|wxNO);

if ($result == wxYES) {
$self-Destroy;
}
}

If I click the no button, all works fine, but if I choose yes to close
the
application, it appears a perl interpreter error window.

It is strange, because if I don't open that MessageBox, it doesn't appear
that error, although the same code is executed.
I've seen that even if I open a simple message box in the event handler
subroutine and I just print a message without checking for a return code,
it
still gives that error.

The following handler works fine:

sub OnExit {
my ($self, $event) = @_;
$self-Destroy;
}

Does it happen for you also or I need to re-install perl or WxPerl?

Thank you.

Octavian







creating dialogs in a secondary thread

2008-08-28 Thread Octavian Rasnita

Hi,

My program uses an internal web server which is ran in a separate thread and
when a certain address is accessed, I want it to display a certain
Wx::Dialog.

I've seen that I can display with no problems a Wx::MessageBox, but I can't
display well a Wx::Dialog because it freezes the application. The dialog
doesn't display anything on the screen, or at least with my screen reader I
can read just the title of the dialog. If I close the dialog with Alt+F4, it
appears a window telling me that the application is not responding, and it
asks me if I want to end it now.

I have tried both to set a parent to the dialog (the main frame of the
program which is created in the main thread) and I have also tried to set
the parent to undef, using also the style wxDIALOG_NO_PARENT, but it still
doesn't work.

Do you know why Wx::MessageBox works but not Wx::Dialog and if it is
possible to do what I want, maybe using another ways?

Here is the dialog I tried to create in that secondary thread (with no
content this time):

my $dialog = Wx::Dialog-new(undef, -1, Test dialog, wxDefaultPosition,
[390, 100], wxDEFAULT_DIALOG_STYLE|wxDIALOG_NO_PARENT);

$dialog-Show(1);

Thank you.

PS. Can you tell me if WxPerl works with Perl 5.10?

Octavian



Re: Ctrl-TAB does not seem to work in menu

2008-08-28 Thread Octavian Rasnita
Ctrl+TAB and Ctrl-TAB work, but maybe you have a control in your app that 
stills this hotkey (like a Wx::Notebook for example).


Octavian

- Original Message - 
From: Gabor Szabo [EMAIL PROTECTED]

To: wxperlusers wxperl-users@perl.org
Sent: Thursday, August 28, 2008 12:08 PM
Subject: Ctrl-TAB does not seem to work in menu



I have the following two menu entries:

   EVT_MENU(
   $self,
   $menu-{view}-Append(-1, Next File A\tCtrl-TAB),
   \on_next_pane,
   );

   EVT_MENU(
   $self,
   $menu-{view}-Append(-1, Next File B\tCtrl-R),
   \on_next_pane,
   );

the only difference is the hot-key.
the Ctrl-R work the Ctrl-TAB does not work even though it is advertised
that it should in 
http://docs.wxwidgets.org/2.6.3/wx_wxmenu.html#wxmenuappend


Am I doing something wrong or is there a bug somewhere else?


Gabor 




Re: Closing the app from system tray

2008-08-26 Thread Octavian Rasnita

Hi Huub,

From: Huub Peters [EMAIL PROTECTED] Octavian Rasnita wrote:

Hi,

I try to close the aplication using the system tray but anything I do, it 
doesn't seem to work.

I put the sample app I've made in this message below.

The problem is that when I click on the tray icon, instead of closing the 
app, it pops up a perl interpreter error window.


If I use just

$self-Destroy;

in the event handler for that event, the application seems to be closed, 
but the system tray icon remains, and the program doesn't really close. 
In this case it doesn't give any error window.

If I use

$self-Close;

and in the EVT_CLOSE event handler I also destroy the tray icon, it 
appear that error window.


I've searched on the internet for this error and I found a few 
discussions, but I haven't seen any solution.


Am I doing something wrong? Or there is no solution of closing a WxPerl 
app using Wx::TaskBarIcon?


Ah yes, the good old system tray issues. I've been fighting with that a 
few years ago too.
I've been experimenting with that a lot and my best guess is that it 
doesn't like the taskbaricon (object) being destroyed in it's own event 
handler.


I also thought that, but I don't know how to solve it.

What I've done in my case is just use a Popup menu and exit from there. 
Maybe that is a usable solution for you to.


Yes it could be. I've made just a short sample program, but the real program 
uses a menu with more options and one of them is Exit.
Another menu item should be used for showing the app and moving the focus to 
a certain object, but I can't do that either.


I altered your code to a working sample using a right click popup menu and 
attached it below.


I have tried your code, but it gives the same error window after choosing 
the Exit menu item:


Perl Command Line Interpreter
Perl Command Line Interpreter has encountered a problem and needs to close. 
We are sorry for the inconvenience.
If you were in the middle of something, the information you were working on 
might be lost.

For more information about this error, click here.
Debug Close

Could it be something wrong with my perl or WxPerl?

I use:

This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 50 registered patches, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Binary build 820 [274739] provided by ActiveState http://www.ActiveState.com

and Wx version 0.85

On a curious side note: does your lack of indenting your code have 
anything to do with you using a screenreader?

Or is this just a quick dirty hack.


Oh yes, sorry. I prefer to write the code this way because when using a 
screen reader without a braille display the indentation creates only 
disadvantages.


For example when I hit the home key to move the cursor to the beginning of 
the line, I don't need to move it back to the start of the text on that line
And I can't see, so I might indent the code badly by mistake, making it 
harder to understand even for the sighted.


When I was sighted I use to indent the code always, no matter how small or 
big was the program.


Thank you.

Octavian



Re: Wx::CheckListBox under Windows

2008-08-22 Thread Octavian Rasnita

From: Mattia Barbon [EMAIL PROTECTED]

Octavian Rasnita wrote:

I also asked on another mailing list, and a list member told me:

When you were compiling wxWidgets, did you enable the accessibility 
flag? You can do this in one of two ways.

1.  remove the comment that says enable accessibility in wx.h
2.  If you are building wxWidgets with MinGW, you can add the 
accessibility flag to the build command

make -f makefile.gcc accessibility=1
or if you are using Msys you could add the flag like so
--enable access
to your other command flags.

Well, I have also installed WxPerl and Alien::wxWidgets from WxPerl 
repository and I don't know if those flags were used to compile 
wxWidgets.


So the checkboxes work fine, but the screen reader can't detect if they 
are on or off when arrowing up or down the list. That's why I thought 
that they are not displayed.


I don't know if compiling wxWidgets with those flags would make 
CheckListBoxes more accessible, but they should be if wxWidgets uses the 
standard Windows control, because the same control is very accessible 
when using Win32::GUI, and it also uses the standard Win32 controls.


  I think Win32::GUI might be using a different native control
(a ListView with LVS_EX_CHECKBOXES style).


Yes, most probably. I have also first tried to find the option to use check 
boxes in a Wx::ListView because the ListView under Win32::GUI can have check 
boxes.
Does wxWidgets offer support for checkboxes in a Wx::ListView? I think that 
if it does, it might use the same control under Windows like Win32::GUI.


If it doesn't, is there a way of using a native control like the one you 
told about in an application that uses WxPerl?


Does anyone know if wxWidgets were compiled using those flags I told 
about above?


  wxPerl was not compiled with those flags, but I doubt it would help
in your case.  I will enable it for the next Alien::wxWidgets release
just in case.


Thank you. I think those flags won't hurt anyway and it might be helpful for 
other things also.


Octavian



Re: getting the values from Wx::Dialog

2008-08-21 Thread Octavian Rasnita

Thank you Brian,

I've also tried to do something like that, but unfortunately I need to use 
threads and pass shared vars from a thread to another, and threads::shared 
is not very friendly with hashes of hashes which I need to use.


So finally I use shared scalars, array and hash refs which are local for 
each module and I access the objects from those modules using the whole path 
of classes like


$self-main_form-dialog1-method1(...);

Until now is OK, although I think it wouldn't be pretty nice if I would need 
to create a very complex program in perl...


Octavian

- Original Message - 
From: Brian Donorfio [EMAIL PROTECTED]

To: Octavian Rasnita [EMAIL PROTECTED]
Cc: wxperl-users@perl.org
Sent: Thursday, August 21, 2008 4:16 PM
Subject: Re: getting the values from Wx::Dialog


On Sun, Aug 17, 2008 at 10:03 AM, Octavian Rasnita [EMAIL PROTECTED] 
wrote:

Hi,

I need to create a modal dialog window with a few fields and after 
closing

it, I need to return the values of those fields to the parent window.

Please tell me which is the recommended way to do that. I've tried a few
ways, but none of them looks clean.

If I need to do what I said, do I need to use global variables like

$main::var
or
$myapp-{var}


If it is possible, I would like to be able to not use them, because the
program would need too many and it will be hard to understand it after a
time.

I've tried something like:

package MyApp::Main;

use MyApp::Main::Dialog;
use base 'Wx::Frame';

sub new {
my ($class, $parent) = @_
my $self = $class-SUPER::new($parent, ...);

$self-{dialog} = MyApp::Main::Dialog-new($self);
$self-{dialog}-ShowModal();

# Here I want to access the values from the fields from the closed dialog
}

I have also tried to store the code that creates the dialog in 
MyApp::Main,
but the event handler which is executed when pressing the Ok button of 
the
dialog gets the $self which is the instance of the dialog, and not the 
Main

form, so I can't use it to store the variables I need.

I'm pretty confused.
Please tell me which do you think it is the cleanest way to do that.

Thank you.

Octavian




Hi Octavian,

I've always just used a hash reference to pass values back and forth.
There may be a more Wx-approved way of doing this, but references are
straightforward enough. I usually clean it up by moving a lot of the
code that deals with this out to other methods (usually a
fill_defaults() called from the constructor, and a validate_entries()
and save_entries() at the end), but you can organize it however you
want.

package MyApp::Main;
...
my %dialog_options = ( foo = 'bar' );
my $dialog = MyApp::Main::Dialog-new($self, \%dialog_options);
$dialog-ShowModal;
# $dialog_options{foo} now has inputted value

package MyApp::Main::Dialog;
sub new {
my ($class, $parent, $options_ref) = @_;
my $self = $class-SUPER::new(...);
$self-_create_widgets;
$self-{_options} = $options_ref;
$self-{FooWidget}-SetValue($self-{_options}-{foo});
}

sub ok_button_clicked {
my ($self) = @_;
$self-{_options}-{foo} = $self-{FooWidget}-GetValue;
$self-EndModal(wxID_OK);
}

-Brian 




Wx::Locale

2008-08-19 Thread Octavian Rasnita

Hi,

I've seen that WxPerl uses gettext as the base for Wx::Locale, just like 
Catalyst framework uses gettext in Catalyst::Plugin::I18N.


In Catalyst I can do:

t(The name of the city is [_1], $city);
or
t(The cities are [_1], [_2] and [_3], [$city1, $city2, $city3]);

This is very convenient, because in some languages the position of the 
variable parts in the phrase is different than in English.


I've tried to do the same thing with Wx::Locale, but it gave an error. It 
seems that it accepts a single parameter, not more.


Is there another way of doing in a WxPerl application the same thing that 
could be done in Catalyst?


Thank you.

Octavian



Setting the Ok and Cancel key defaults

2008-08-06 Thread Octavian Rasnita

Hi,

I have 2 buttons on a Wx::Dialog window, and I want one of them to be 
pressed when I hit enter on a text field, and the other one to be pressed 
when I press the escape key.


I have read on the manual page of Wx::Dialog that I can use wxOK, or 
wxID_OK, wxCANCEL, or wxID_CANCEL (I didn't understand which of them) in 
order to do this, but it doesn't seem to work.


I have also tried to use SetAffirmativeId() and SetEscapeId() but after 
doing that, I couldn't close the dialog with the close button even if I 
press it with the space bar.


So I am sure I am doing something wrong. Can you tell me the right way to do 
what I want?


Thank you.

Octavian



Default column size

2008-08-02 Thread Octavian Rasnita

Hi,

I am trying to create a ListView in report mode, and I want the columns to 
have a width that can hold the biggest string from each column.


I have read that by default this happends when I use the -1 width, but all 
the columns are created smaller than that and the text from each column is 
shortened and then 3 dots appended to them.


Here is the code:

$rss_list = Wx::ListView-new($panel, -1, [0, 0], [660, 300], 
wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_HRULES);


$rss_list-InsertColumn(0, Date/Time, wxLIST_FORMAT_LEFT, -1);
$rss_list-InsertColumn(1, Article title, wxLIST_FORMAT_LEFT, -1);
$rss_list-InsertColumn(2, Source, wxLIST_FORMAT_LEFT, -1);
$rss_list-InsertColumn(3, Author, wxLIST_FORMAT_LEFT, -1);

After the list displays the content, if I press Control+Num pad plus, (in 
order to make the columns larger to show the entire content), the content is 
shown well, but I want this to happen by default.


Am I missing something, or doing something wrong?

Thank you.

Octavian



Re: Wx::MediaCtrl

2008-07-31 Thread Octavian Rasnita
From: Huub Peters [EMAIL PROTECTED]
 What platform?
 - On Windows using the ppm's from wxperl.co.uk it should work out of 
 the box (using MediaPlayer).

Sorry for the dumb question. Yes I use Windows and now it works.

I've tried to use Wx::MediaCtrl instead of use Wx::Media.

Octavian



Re: Padre 0.02 released

2008-07-29 Thread Octavian Rasnita
Hi,

I've downloaded Padre 0.03.

I found a new module which is required but perl Makefile.pl can't detect that's 
required.

It is Pod::Simple::HTML.

I wrote another message yesterday but I couldn't send it because I had no 
internet connection at home.

The labels from some menus are not defined at all, so there are no hotkeys 
defined for them either explicitly.
The problem is that some menus have a label defined, but their hotkeys are not 
defined well.

For example, instead of 

Search again (F3)

if I changed to

Search again\tF3

the hotkey F3 works fine.

and it is the same for other modules which don't use this syntax.

Some modules like copy, paste, have a stock ID defined and the hotkeys for them 
work fine even it doesn't appear in the menu, but I think the best idea would 
be to set the labels explicitly and also define a hotkey manually for them, 
because it will be visible in the menu item.

I don't know, maybe if the label for a menu that has a stock ID defined is not 
specified explicitly, that menu label will appear in different languages based 
on the locale, so it would be an advantage, but if a translation is wanted, I 
think it is better to specify the labels manually, specify the hotkeys, and do 
the translation separately using a perl module for that thing.

Octavian

- Original Message - 
From: Gabor Szabo [EMAIL PROTECTED]
To: wxperl-users wxperl-users@perl.org
Sent: Monday, July 28, 2008 11:37 AM
Subject: Re: Padre 0.02 released


 Hi Octavian,
 
 thanks for your time and detailed report.
 
 Hopefully in a few days I am going to setup a version control and bug
 tracking system specifically for this project to make it easier to get 
 involved.
 
 In the meantime let me address your mail point by point here.
 
 On Sun, Jul 27, 2008 at 12:36 PM, Octavian Rasnita [EMAIL PROTECTED] wrote:
 Hi,

 I use Win XP Pro SP3, Active Perl 5.8.8.

 Here is my feedback:

 1. I think you should specify that the program requires
 Wx::Perl::ProcessStream

 After perl Makefile.pl it didn't tell me that I don't have that module
 installed, but it gave an error on make test.
 After I installed that module, I was able to install your program without
 other errors.
 
 This is strange as that module is in the list of prereq but I have seen
 similar issues recently. I just never had the time to investigate them.
 
 
 2. I have opened a file, but I can't close the editor.
 I think that I have modified it a little by mistake, and it forces me to
 save what I've done, because otherwise it doesn't want to close it without
 saving.
 I think you should add a Cancel button to that dialog, or ask if the user
 wants to save, and offer the yes, no, and cancel buttons.
 
 
 3. I have tried Help menu/Help, but I couldn't read anything there.
 Have you used an HTML control in that window?
 (That control is absolutely not accessible for screen readers.)
 I think the prefered way, not only for the blind, would be to create a .chm
 help file.
 
 That whole thing will have to be reworked. For 0.03 I put in a default page
 as it was empty. BTW You can open any pod file with that and if you highlight 
 a
 module name in the editor and  press ctr-shift-h you get the pod of
 that module.
 
 4. When switching the panes using control+tab, the program works fine, but
 the focus is set to the tab label. A more friendly way would be to set the
 focus in the text document directly, because usually this is the wanted
 thing.
 (But for a first version, it is very OK as it is.)
 
 Funny. I have not implemented that so you got that free of charge from
 Wx on MS Windows. In 0.03 I explicitly added this support.
 
 
 5. A suggestion: In the file menu, usually the New is located above the
 Open.
 When I opened the File menu, I thought that this editor doesn't have a New
 option. :-)
 
 As said, I have no clue how these work in other systems. I usueally just type
 Esc :e filename
 to open a file.
 
 Anyway, fixed.
 
 6. In the Edit menu, you should add the hotkeys for Undo, redo... because at
 least Control+Z works, but this is not visible from the menu.
 
 I am using
 
 EVT_MENU( $self, $edit-Append( wxID_UNDO,''   ), \on_undo);
 
 but it seems the stock item does not add the hotkeys to the menu, not
 even on linux.
 Do you see the hotkey on he File/New menu? I see it on Ubuntu but I am not
 sure I was it when I tried it on Windows.
 
 
 7. The hotkey for Find again (F3) doesn't seem to work. If I choose the
 menu option though, it works fine.
 
 I think I reported this already that on_key does not seem to work on windows.
 I'll have to investigate it how to make it work.
 
 8. Another suggestion: A status bar that could possibly show the line and
 column number, won't hurt. :-)
 
 see 0.03
 

 9. I don't understand what does it refer to Max number of modules and min
 number of modules in the Setup window.
 
 explained in the docs of 0.03 - I hope
 
 10. It would be nice to be able to close the files using Control+F4

The methods of $event

2008-07-29 Thread Octavian Rasnita

Hi,

I've seen that an event handler always receives a $event as a second 
parameter and that this event can be used to do many methods, depending on 
the event that triggered that event handler.


Where can I find all the methods which I can use for each event type?
(Please just tell me where to search for them in the chm manual.)

Thank you.

Octavian



Re: Padre 0.02 released

2008-07-28 Thread Octavian Rasnita
Hi,

See my answers below.

 thanks for your time and detailed report.

You're welcome. And, congratulations for your work.

 6. In the Edit menu, you should add the hotkeys for Undo, redo... because at
 least Control+Z works, but this is not visible from the menu.
 
 I am using
 
 EVT_MENU( $self, $edit-Append( wxID_UNDO,''   ), \on_undo);

I am not a WxPerl expert, but I use to specify the labels and the hotkeys for 
menus, using something like:

LabelName\tCtrl+L

In your form of defining the menus maybe you should put this where you have ''.


 but it seems the stock item does not add the hotkeys to the menu, not
 even on linux.
 Do you see the hotkey on he File/New menu? I see it on Ubuntu but I am not
 sure I was it when I tried it on Windows.

I can see the hotkeys on some menus, but a stranger hotkey, like Ctr+letter or 
something like that, not as Ctrl+letter as I think it should.
(But I can't test right now, because the app is installed at home.)

 10. It would be nice to be able to close the files using Control+F4.
 
 It is now Ctr-W as it is in gedit and in several other apps on Ubuntu.
 I wonder if this is a difference between the standard of Linux and Windows?

Maybe. I don't know because I can't use very well a Linux GUI so I can't 
compare.
But I think that it wouldn't be something wrong if 2 different hotkeys would be 
used for the same action.

 15. I couldn't use the options from the Run menu.
 I have configured it to run

 perl
 perl $file (like in TextPad)
 perl file.txt

 where file.txt is the currently opened file, but when using F5 or
 Control+F5, nothing happend.
 I've seen that there is a command results (maybe) readonly text field at the
 bottom of the window, but nothing is printed there.

 Anyway, if that it is a field for outputting the results, it would be nice
 to have a hotkey that moves the cursor there, because if somebody wants to
 copy the results but it doesn't use a mouse it can't do it.
 
 Yeah, that's it.
 
 What should be that hot-key?
 What is the standard?

I don't know if there is a standard for doing that.
I've seen other editors that don't have that hotkey defined, so I can't use 
them.
I prefer using TextPad, which creates a new common document window for 
displaying the results (STDOUT and STDERR), and that document window is as 
accessible as any other document window.
And it gets the focus automaticly after running the current program if it 
outputs a result on STDOUT or STDERR.

Octavian



Wx::ActiveX

2008-07-24 Thread Octavian Rasnita
Hi,

I have 2 questions regarding the use of ActiveX under WxPerl.

I've seen that Wx::ActiveX is much more developed than Win32::GUI::AxWindow. 
With Win32::GUI::AxWindow it was possible to display a page created by the 
program, and not only to view a remote URL or external file. Is this possible 
with Wx::ActiveX?
(I need to use ActiveX because the HTML widget is not accessible for screen 
readers at all.)

The second question might be a little more complicated, because it might be a 
problem that is not of Wx::Activex.
I've displayed the page of Google using Wx::ActiveX, and I've tried to search 
something with the search engine, but I could search only by clicking the 
Google search button. If I just hit enter, it doesn't work.

Do you have any idea if there is a way to make it work like Internet Explorer 
works? Should I make some settings to the ActiveX object?
Or do I need to define some aditional event handlers to be able to send a form 
by just pressing enter on an edit field?

Thank you.

Octavian



event generated when closing the window

2008-07-23 Thread Octavian Rasnita
Hi,

How can I handle the event generated when I close the window with alt+F4?

The app uses threads and I want to kill the threads when I close the window and 
do other cleaning jobs.

Thank you.

Octavian



WxPerl threads

2008-04-20 Thread Octavian Rasnita

Hi,

I've read
http://search.cpan.org/~mbarbon/Wx-0.82/lib/Wx/Thread.pod

and I've started to create a test program (that I enclosed below), but as 
the POD docs from the URL above doesn't include a working example, I don't 
understand how to make it really work.


I've seen in the POD:

sub done {
my( $frame, $event ) = @_;

Isn't this subroutine the event handler? Or the following one?

sub OnCreateThread {
my( $self, $event ) = @_; @_ = ();

But if this is the event handler, where is it called in the program?

Then in this subroutine I've seen:

threads-create( ... );

Why should I create the threads in this subroutine when at the beginning of 
the script I've done:


my $worker = threads-create( \work );

Here below is the script I tried to make, although the worker thread doesn't 
print anything in the TextCtrl.


Thank you.

Octavian

use threads;
use threads::shared;
use Wx;

my $done_event : shared = Wx::NewEventType;

my $worker = threads-create(\worker);

package MyApp;

use base 'Wx::App';

sub OnInit {
my $self = shift;
my $frame = MyFrame-new();

$frame-Show(1);
$self-SetTopWindow($frame);
return 1;
}

package MyFrame;

use base 'Wx::Frame';
use Wx qw(wxTE_MULTILINE);
use Wx::Event qw(EVT_COMMAND);

sub new {
my $class = shift;
my $self = $class-SUPER::new(undef, -1, The title);

$self-{text} = Wx::TextCtrl-new($self, -1, , [100,100], [500, 500], 
wxTE_MULTILINE);


$self-{text}-AppendText(test\n);

EVT_COMMAND($self, -1, $done_event, \done);

return $self;
}

sub done {
my ($self, $event) = @_;

my $text = $event-GetData;
$self-{text}-AppendText($text\n);
}

sub OnCreateThread {
my ($self, $event) = @_; @_ = ();
print OnCreateThread\n;
}

package main;
MyApp-new-MainLoop;

sub worker {
use LWP::Simple;

my @sites = qw(
http://www.google.com/
http://www.microsoft.com/
http://www.yahoo.com/
http://www.cpan.org/
http://www.perl.org/
);

for(0 .. $#sites) {
my $page = get($sites[$_]);
my ($title1) = $page =~ /title[^]*\s*(.+?)\/title[^]*/gsi;
my $title : shared = $title1;

print $title\n;

my $thread_event = Wx::PlThreadEvent-new(-1, $done_event, $title);
Wx::PostEvent($self, $thread_event);
}
}

__END__



Re: Stopping WxMenu from trying to be smart

2008-04-14 Thread Octavian Rasnita

Hi Mark,

Thank you for your samples. They help me also.

But I want to ask, if we use Locale, shouldn't we use Ctrl as usually,
then the module would need to translate it to another string, based on the
language chosen (maybe from a configuration file)?
I've seen that Strg is hard coded in the source, and maybe it won't change 
to another string if the program would use another language.


Thanks.

Octavian

- Original Message - 
From: Mark Dootson [EMAIL PROTECTED]

To: herbert breunung [EMAIL PROTECTED]
Cc: wxperl-users wxperl-users@perl.org
Sent: Monday, April 14, 2008 7:17 AM
Subject: Re: Stopping WxMenu from trying to be smart



Hi,

I've followed this up because I'm currently working on ways to
internationalize without using gettext (at least not creating my own
catalogs) and menu labels are a difficulty.

I've had a look at the wxWidgets source and the parsing of the menu label
wraps 'ctrl', 'alt' and 'shift' in the wxTRANSLATE macro - which means -
to get translations you need to have a gettext catalog for the current
locale with translations for 'ctrl', 'alt' and 'shift', and the labels
would have to be set using appropriate text for current locale.

In the wxWidgets source, there are gettext catalogs under the 'locale'
directory.
I edited de.po from

#: ../src/common/menucmn.cpp:197
msgid ctrl
msgstr ctrl

to

#: ../src/common/menucmn.cpp:197
msgid ctrl
msgstr strg

then compiled with
make de.mo

(actually mingw32-make as I'm on Windows)

The attached code now does exactly what you want in the correct way. Looks
like I'll have to learn to love gettext :-(

Regards

Mark


Mark Dootson wrote:

Hi,

I think you have to use Wx::AcceleratorTable

Attached is minimal script I used to check suggestion.

Regards

Mark

herbert breunung wrote:

thanks  i already tried something similiar ugly but i didnt know
that the object that making this is Wx::AcceleratorTable.
i will try to delete it or override it, since i capture key events
anyway.
tanks a lot for that tip

thanks
herbert












use strict;
package MyApp;
use Wx qw(wxLANGUAGE_GERMAN);
use base qw( Wx::App );

sub OnInit {
   my $self = shift;

   my $locale = Wx::Locale-new(wxLANGUAGE_GERMAN);
   $locale-AddCatalogLookupPathPrefix('c:\pathtolangdir');
   $locale-AddCatalog('de');
   my $mwin = MyFrame-new();
   $self-SetTopWindow($mwin);
   $mwin-Show(1);
   return 1;
}


package MyFrame;
use Wx qw( :id :misc wxACCEL_CTRL );
use Wx::Event qw( EVT_MENU );
use base qw( Wx::Frame );


sub new {
   my $class = shift;
   my $self = $class-SUPER::new(
   undef,
   wxID_ANY,
   'Test App',
   wxDefaultPosition,
   wxDefaultSize
   );


   $self-{menu} = Wx::Menu-new();
   my $id1 = $self-{menu}-Append(wxID_ANY, First
Task\tStrg+T)-GetId();
   my $id2 = $self-{menu}-Append(wxID_ANY, Some Other
Task\tStrg+O)-GetId();
   my $menubar = Wx::MenuBar-new();
   $menubar-Append($self-{menu}, 'File');
   $self-SetMenuBar($menubar);


   EVT_MENU($self, $id1, \on_event_task);
   EVT_MENU($self, $id2, \on_event_task);

   $self-Centre;
   return $self;
}

sub on_event_task {
   my($self, $event) = @_;
   my $labeltext = $self-{menu}-GetLabelText($event-GetId);
   Wx::LogMessage('Event %s', $labeltext);
}


package main;

my $app = MyApp-new();
$app-MainLoop;

1;









Re: superscript/subscript

2008-03-26 Thread Octavian Rasnita
Ok, thank you Mattia. I will wait and I will try, hoping that it will work 
with wxTextAttr/wxTextCtrl.


But by the way, do you have any idea why wxRichTextCtrl can't be used with 
the keyboard? (Why the focus moves to the previous/next control when I use 
arrow up or down).

Can this changed with some styles of wxRichTextAttr?

Thank you.

Octavian

- Original Message - 
From: Mattia Barbon [EMAIL PROTECTED]

To: Octavian Rasnita [EMAIL PROTECTED]
Cc: Mark Dootson [EMAIL PROTECTED]; wxperl-users@perl.org
Sent: Wednesday, March 26, 2008 12:19 AM
Subject: Re: superscript/subscript



Octavian Rasnita wrote:

  Hi,


Ok, thank you. I will wait until then.

But what exactly is Wx::TextAttrEx? A kind of extension of Wx::TextAttr 
that can be used wherever Wx::TextAttr is used?


  In wxWidgest 2.8.x, you can use wxTextAttr with wxTextCtrl and 
wxTextAttrEx/wxRichTextAttr with wxRichTextCtrl.  In svn HEAD

all the methods of wxRichTextAttr/wxTextAttrEx have been moved to
wxTextAttr, but this does not necessarily mean that all of them make
sense with plain wxTextCtrl.

  I believe the advice you got below refers to wxRichTextCtrl.

  Anyway, I'm going to add the missing functions/constants to
wxPerl subversion, so they will be included in the next release.

Regards,
Mattia


- Original Message - From: Mark Dootson [EMAIL PROTECTED]
To: Octavian Rasnita [EMAIL PROTECTED]
Cc: wxperl-users@perl.org
Sent: Tuesday, March 25, 2008 8:33 PM
Subject: Re: superscript/subscript



you are quite right

SetTextEffects is not wrapped.

It would be in Wx::TextAttrEx in the current release if it were.

You shall have to wait until it is. That should not be too long. I shall 
have a go at a patch myself, but I must admit I am not a user of 
RichText control.



Octavian Rasnita wrote:

Hi Mark,

Thank you for help. I've tried the following:

my $subscript = Wx::TextAttr-new();
$subscript-SetTextEffects(wxTEXT_ATTR_EFFECT_SUBSCRIPT);
$subscript-Wx::TextAttr::SetFlags(wxTEXT_ATTR_EFFECT_SUBSCRIPT);

However, it gives the error that the subroutine SetTextEffects is not 
defined in Wx::TextAttr.


Can I do with other methods what that subroutine is doing in order to 
create a subscript style?


Thank you.

Octavian

- Original Message - From: Mark Dootson 
[EMAIL PROTECTED]

To: Octavian Rasnita [EMAIL PROTECTED]
Cc: wxperl-users@perl.org
Sent: Tuesday, March 25, 2008 7:13 PM
Subject: Re: superscript/subscript



Hi Octavian,

I had a look at the wxWidgets headers and found the following.

#define wxTEXT_ATTR_EFFECT_NONE 0x
#define wxTEXT_ATTR_EFFECT_CAPITALS 0x0001
#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS   0x0002
#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH0x0004
#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x0008
#define wxTEXT_ATTR_EFFECT_SHADOW   0x0010
#define wxTEXT_ATTR_EFFECT_EMBOSS   0x0020
#define wxTEXT_ATTR_EFFECT_OUTLINE  0x0040
#define wxTEXT_ATTR_EFFECT_ENGRAVE  0x0080
#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT  0x0100
#define wxTEXT_ATTR_EFFECT_SUBSCRIPT0x0200


So, until constants are included in wxPerl you should be able to do

sub wxTEXT_ATTR_EFFECT_SUBSCRIPT () {  0x0200 }

and it should work for you.
I have not tested this though.

Regards

Mark






Octavian Rasnita wrote:

Hi,

I've asked on another list regarding the use of superscripts and 
subscripts in a rich text TextCtrl widget, and here below is the 
answer I received.


I've also tried doing:

use Wx qw(wxTEXT_ATTR_EFFECT_SUBSCRIPT);

but it gave an error telling that this constant isn't exported by the 
Wx module.
If these constants I need are not exported by Wx, so they can't be 
used in WxPerl, but if wxWidget supports using superscripts and 
subscripts, couldn't I use their values instead?


Here is the message I've received. Thank you.

Hi Octavian.  Here are some notes for you which i had gotten from my
research.  I have tried them and they work, but i would think the 
best way
would be to call the DC or draw context function.  Anyway, I had the 
3
outlined methods tried out, all worked successfully, and you can 
choose

which method would suit you best.
Notes below.
Implementing superscript/subscript
1. Representation
In richtextbuffer.h (or textctrl.h in SVN trunk), we have the
wxTEXT_ATTR_EFFECT_SUBSCRIPT and wxTEXT_ATTR_EFFECT_SUPERSCRIPT text
effect styles defined. So you would do this programmatically:
wxTextAttrEx attr;
attr.SetTextEffects(wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
attr.SetTextEffectFlags(wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
control-SetStyle(from, to, attr);
(The purpose of SetTextEffectFlags is to indicate which flags are
relevant to the current operation, i.e. setting the given styles.)
In Word and OpenOffice, the font you specify for the superscript text 
is

not the one that’s used – some multiplication

superscript/subscript

2008-03-25 Thread Octavian Rasnita

Hi,

I've asked on another list regarding the use of superscripts and subscripts 
in a rich text TextCtrl widget, and here below is the answer I received.


I've also tried doing:

use Wx qw(wxTEXT_ATTR_EFFECT_SUBSCRIPT);

but it gave an error telling that this constant isn't exported by the Wx 
module.
If these constants I need are not exported by Wx, so they can't be used in 
WxPerl, but if wxWidget supports using superscripts and subscripts, couldn't 
I use their values instead?


Here is the message I've received. Thank you.

Hi Octavian.  Here are some notes for you which i had gotten from my
research.  I have tried them and they work, but i would think the best way
would be to call the DC or draw context function.  Anyway, I had the 3
outlined methods tried out, all worked successfully, and you can choose
which method would suit you best.
Notes below.
Implementing superscript/subscript
1. Representation
In richtextbuffer.h (or textctrl.h in SVN trunk), we have the
wxTEXT_ATTR_EFFECT_SUBSCRIPT and wxTEXT_ATTR_EFFECT_SUPERSCRIPT text
effect styles defined. So you would do this programmatically:
wxTextAttrEx attr;
attr.SetTextEffects(wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
attr.SetTextEffectFlags(wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
control-SetStyle(from, to, attr);
(The purpose of SetTextEffectFlags is to indicate which flags are
relevant to the current operation, i.e. setting the given styles.)
In Word and OpenOffice, the font you specify for the superscript text is
not the one that’s used – some multiplication factor is used to scale
the font. This could be hardwired, simplifying the API, or it could be
specified (optionally). You might use an existing field to do this, e.g.
m_outlineLevel since this is a paragraph attribute and wouldn’t be used
for at the character level anyway. You could have new functions to
access this, e.g. wxTextAttrEx::SetScriptSize,
wxTextAttrEx::GetScriptSize. A value of zero would cause the default to
be used. We would probably need an extra flag, wxTEXT_ATTR_SCRIPT_SIZE
to indicate whether this is set.
I’m also assuming that the positioning is hard-wired to be the top or
the bottom of the text to the left of the super/subscript text. This
probably doesn’t need customisation.
2. Drawing implementation
In wxRichTextPlainText::Draw, the new effect flags will need to be
checked – if either is present, the smaller font must be created from
the current attribute font and a scale factor, and x and y text
positions should be recalculated to allow for the smaller font. So,
something like:
if (textAttr.GetFont().Ok()) // this has been moved up w.r.t. current
SVN so GetCharHeight returns correct value
wxCheckSetFont(dc, textAttr.GetFont());
int charHeight = dc.GetCharHeight();
int x = rect.x;
int y = rect.y + (rect.height - charHeight - (descent - m_descent));
if (textAttr.HasTextEffects()  (textAttr.GetTextEffects() 
(wxTEXT_ATTR_EFFECT_SUBSCRIPT| wxTEXT_ATTR_EFFECT_SUPERSCRIPT)))
{
wxFont scriptFont(textAttr.GetFont().GetPointSize() * 0.5, ...);
wxCheckSetFont(dc, scriptFont);
// y is already correct for superscript
if (textAttr.GetTextEffects()  wxTEXT_ATTR_EFFECT_SUBSCRIPT)
{
y = rect.y + (rect.height – dc.GetCharHeight() – (descent – m_descent)
}
}
wxRichTextPlainText::GetRangeSize needs a similar treatment to make sure
the text width is calculated using the smaller font, but the height
should continue to reflect the specified (larger) font. So
dc.GetCharHeight() should be used to calculate the line height with the
_attribute_ font set in the DC, whereas ‘w’ should be calculated with
smaller font set.
3. UI implementation
The font page (richtextfontpage.h/cpp) needs to be updated to allow
specification of superscript or subscript. This can be done with 3-state
checkboxes via the DialogBlocks .pjd file in src/richtextctrl (copy an
existing one, e.g. Capitals). Then the code in TransferDataFromWindow/
TransferDataToWindow needs changing – should be obvious from the
existing handling what’s required. It probably also needs event handlers
for the two new checkboxes to clear (or rather make indeterminate) the
other checkbox so you can’t specify subscript and superscript
simultaneously.
UpdatePreview() can be updated to simply scale the font if either of the
new styles are set.
Cheers!


Octavian



Re: superscript/subscript

2008-03-25 Thread Octavian Rasnita

Hi Mark,

Thank you for help. I've tried the following:

my $subscript = Wx::TextAttr-new();
$subscript-SetTextEffects(wxTEXT_ATTR_EFFECT_SUBSCRIPT);
$subscript-Wx::TextAttr::SetFlags(wxTEXT_ATTR_EFFECT_SUBSCRIPT);

However, it gives the error that the subroutine SetTextEffects is not 
defined in Wx::TextAttr.


Can I do with other methods what that subroutine is doing in order to create 
a subscript style?


Thank you.

Octavian

- Original Message - 
From: Mark Dootson [EMAIL PROTECTED]

To: Octavian Rasnita [EMAIL PROTECTED]
Cc: wxperl-users@perl.org
Sent: Tuesday, March 25, 2008 7:13 PM
Subject: Re: superscript/subscript



Hi Octavian,

I had a look at the wxWidgets headers and found the following.

#define wxTEXT_ATTR_EFFECT_NONE 0x
#define wxTEXT_ATTR_EFFECT_CAPITALS 0x0001
#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS   0x0002
#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH0x0004
#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x0008
#define wxTEXT_ATTR_EFFECT_SHADOW   0x0010
#define wxTEXT_ATTR_EFFECT_EMBOSS   0x0020
#define wxTEXT_ATTR_EFFECT_OUTLINE  0x0040
#define wxTEXT_ATTR_EFFECT_ENGRAVE  0x0080
#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT  0x0100
#define wxTEXT_ATTR_EFFECT_SUBSCRIPT0x0200


So, until constants are included in wxPerl you should be able to do

sub wxTEXT_ATTR_EFFECT_SUBSCRIPT () {  0x0200 }

and it should work for you.
I have not tested this though.

Regards

Mark






Octavian Rasnita wrote:

Hi,

I've asked on another list regarding the use of superscripts and 
subscripts in a rich text TextCtrl widget, and here below is the answer I 
received.


I've also tried doing:

use Wx qw(wxTEXT_ATTR_EFFECT_SUBSCRIPT);

but it gave an error telling that this constant isn't exported by the Wx 
module.
If these constants I need are not exported by Wx, so they can't be used 
in WxPerl, but if wxWidget supports using superscripts and subscripts, 
couldn't I use their values instead?


Here is the message I've received. Thank you.

Hi Octavian.  Here are some notes for you which i had gotten from my
research.  I have tried them and they work, but i would think the best 
way

would be to call the DC or draw context function.  Anyway, I had the 3
outlined methods tried out, all worked successfully, and you can choose
which method would suit you best.
Notes below.
Implementing superscript/subscript
1. Representation
In richtextbuffer.h (or textctrl.h in SVN trunk), we have the
wxTEXT_ATTR_EFFECT_SUBSCRIPT and wxTEXT_ATTR_EFFECT_SUPERSCRIPT text
effect styles defined. So you would do this programmatically:
wxTextAttrEx attr;
attr.SetTextEffects(wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
attr.SetTextEffectFlags(wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
control-SetStyle(from, to, attr);
(The purpose of SetTextEffectFlags is to indicate which flags are
relevant to the current operation, i.e. setting the given styles.)
In Word and OpenOffice, the font you specify for the superscript text is
not the one that’s used – some multiplication factor is used to scale
the font. This could be hardwired, simplifying the API, or it could be
specified (optionally). You might use an existing field to do this, e.g.
m_outlineLevel since this is a paragraph attribute and wouldn’t be used
for at the character level anyway. You could have new functions to
access this, e.g. wxTextAttrEx::SetScriptSize,
wxTextAttrEx::GetScriptSize. A value of zero would cause the default to
be used. We would probably need an extra flag, wxTEXT_ATTR_SCRIPT_SIZE
to indicate whether this is set.
I’m also assuming that the positioning is hard-wired to be the top or
the bottom of the text to the left of the super/subscript text. This
probably doesn’t need customisation.
2. Drawing implementation
In wxRichTextPlainText::Draw, the new effect flags will need to be
checked – if either is present, the smaller font must be created from
the current attribute font and a scale factor, and x and y text
positions should be recalculated to allow for the smaller font. So,
something like:
if (textAttr.GetFont().Ok()) // this has been moved up w.r.t. current
SVN so GetCharHeight returns correct value
wxCheckSetFont(dc, textAttr.GetFont());
int charHeight = dc.GetCharHeight();
int x = rect.x;
int y = rect.y + (rect.height - charHeight - (descent - m_descent));
if (textAttr.HasTextEffects()  (textAttr.GetTextEffects() 
(wxTEXT_ATTR_EFFECT_SUBSCRIPT| wxTEXT_ATTR_EFFECT_SUPERSCRIPT)))
{
wxFont scriptFont(textAttr.GetFont().GetPointSize() * 0.5, ...);
wxCheckSetFont(dc, scriptFont);
// y is already correct for superscript
if (textAttr.GetTextEffects()  wxTEXT_ATTR_EFFECT_SUBSCRIPT)
{
y = rect.y + (rect.height – dc.GetCharHeight() – (descent – m_descent)
}
}
wxRichTextPlainText::GetRangeSize needs a similar treatment to make sure
the text width is calculated using the smaller font

Re: superscript/subscript

2008-03-25 Thread Octavian Rasnita

Ok, thank you. I will wait until then.

But what exactly is Wx::TextAttrEx? A kind of extension of Wx::TextAttr that 
can be used wherever Wx::TextAttr is used?


Thanks.
Octavian

- Original Message - 
From: Mark Dootson [EMAIL PROTECTED]

To: Octavian Rasnita [EMAIL PROTECTED]
Cc: wxperl-users@perl.org
Sent: Tuesday, March 25, 2008 8:33 PM
Subject: Re: superscript/subscript



you are quite right

SetTextEffects is not wrapped.

It would be in Wx::TextAttrEx in the current release if it were.

You shall have to wait until it is. That should not be too long. I shall 
have a go at a patch myself, but I must admit I am not a user of RichText 
control.



Octavian Rasnita wrote:

Hi Mark,

Thank you for help. I've tried the following:

my $subscript = Wx::TextAttr-new();
$subscript-SetTextEffects(wxTEXT_ATTR_EFFECT_SUBSCRIPT);
$subscript-Wx::TextAttr::SetFlags(wxTEXT_ATTR_EFFECT_SUBSCRIPT);

However, it gives the error that the subroutine SetTextEffects is not 
defined in Wx::TextAttr.


Can I do with other methods what that subroutine is doing in order to 
create a subscript style?


Thank you.

Octavian

- Original Message - From: Mark Dootson [EMAIL PROTECTED]
To: Octavian Rasnita [EMAIL PROTECTED]
Cc: wxperl-users@perl.org
Sent: Tuesday, March 25, 2008 7:13 PM
Subject: Re: superscript/subscript



Hi Octavian,

I had a look at the wxWidgets headers and found the following.

#define wxTEXT_ATTR_EFFECT_NONE 0x
#define wxTEXT_ATTR_EFFECT_CAPITALS 0x0001
#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS   0x0002
#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH0x0004
#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x0008
#define wxTEXT_ATTR_EFFECT_SHADOW   0x0010
#define wxTEXT_ATTR_EFFECT_EMBOSS   0x0020
#define wxTEXT_ATTR_EFFECT_OUTLINE  0x0040
#define wxTEXT_ATTR_EFFECT_ENGRAVE  0x0080
#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT  0x0100
#define wxTEXT_ATTR_EFFECT_SUBSCRIPT0x0200


So, until constants are included in wxPerl you should be able to do

sub wxTEXT_ATTR_EFFECT_SUBSCRIPT () {  0x0200 }

and it should work for you.
I have not tested this though.

Regards

Mark






Octavian Rasnita wrote:

Hi,

I've asked on another list regarding the use of superscripts and 
subscripts in a rich text TextCtrl widget, and here below is the answer 
I received.


I've also tried doing:

use Wx qw(wxTEXT_ATTR_EFFECT_SUBSCRIPT);

but it gave an error telling that this constant isn't exported by the 
Wx module.
If these constants I need are not exported by Wx, so they can't be used 
in WxPerl, but if wxWidget supports using superscripts and subscripts, 
couldn't I use their values instead?


Here is the message I've received. Thank you.

Hi Octavian.  Here are some notes for you which i had gotten from my
research.  I have tried them and they work, but i would think the best 
way

would be to call the DC or draw context function.  Anyway, I had the 3
outlined methods tried out, all worked successfully, and you can choose
which method would suit you best.
Notes below.
Implementing superscript/subscript
1. Representation
In richtextbuffer.h (or textctrl.h in SVN trunk), we have the
wxTEXT_ATTR_EFFECT_SUBSCRIPT and wxTEXT_ATTR_EFFECT_SUPERSCRIPT text
effect styles defined. So you would do this programmatically:
wxTextAttrEx attr;
attr.SetTextEffects(wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
attr.SetTextEffectFlags(wxTEXT_ATTR_EFFECT_SUPERSCRIPT);
control-SetStyle(from, to, attr);
(The purpose of SetTextEffectFlags is to indicate which flags are
relevant to the current operation, i.e. setting the given styles.)
In Word and OpenOffice, the font you specify for the superscript text 
is

not the one that’s used – some multiplication factor is used to scale
the font. This could be hardwired, simplifying the API, or it could be
specified (optionally). You might use an existing field to do this, 
e.g.

m_outlineLevel since this is a paragraph attribute and wouldn’t be used
for at the character level anyway. You could have new functions to
access this, e.g. wxTextAttrEx::SetScriptSize,
wxTextAttrEx::GetScriptSize. A value of zero would cause the default to
be used. We would probably need an extra flag, wxTEXT_ATTR_SCRIPT_SIZE
to indicate whether this is set.
I’m also assuming that the positioning is hard-wired to be the top or
the bottom of the text to the left of the super/subscript text. This
probably doesn’t need customisation.
2. Drawing implementation
In wxRichTextPlainText::Draw, the new effect flags will need to be
checked – if either is present, the smaller font must be created from
the current attribute font and a scale factor, and x and y text
positions should be recalculated to allow for the smaller font. So,
something like:
if (textAttr.GetFont().Ok()) // this has been moved up w.r.t. current
SVN so GetCharHeight returns

PDK

2008-03-21 Thread Octavian Rasnita

Hi,

Is it possible to exclude the dll files which are needed by WxPerl to run in 
a PDK - generated executable?

(And put them separately in the same dir with the executable)

Thanks.


Octavian



Re: PDK

2008-03-21 Thread Octavian Rasnita
Ok, I can specify the location of the dll files on the target machine, but I 
don't know how to prevent that they are included in the executable.


I've also seen that the following is included by wxpdk in the .perlapp file 
and I don't know what it is used for:


Bind: 
gdilib/gdiplus.dll[file=E:/usr/site/lib/Alien/wxWidgets/msw_2_8_7_uni_mslu_gcc_3_4/os/gdiplus.dl_,mode=444]


Strange, but I've tried to create the executable without Wx::Perl::Packager, 
using:


perlapp --gui program_name.pl

and it created an executable that works fine.

So I still don't know how I succeeded to build a .exe program without 
Wx::Perl::Packager nor how to avoid including some dlls.


Octavian

From: bungsuputra linan [EMAIL PROTECTED]


Yes, I think it's possible. In PerlApp window, go to Options 1 tab and
under Run Library, you can specify the location of dll files in Use
run library.

I hope it helps.
Regards,
bungsu

On Fri, 2008-03-21 at 13:48 +0200, Octavian Rasnita wrote:

Hi,

Is it possible to exclude the dll files which are needed by WxPerl to run 
in

a PDK - generated executable?
(And put them separately in the same dir with the executable)

Thanks.


Octavian







Re: wxTextAttr

2008-03-21 Thread Octavian Rasnita

Hi Mattia,

Thank you very much! This is good news.
I've seen that I can set the colors of the text, and the alignment, but I 
couldn't find how to set a certain font with some attributes (bold, italic, 
underline). Could you please give me a short example?


I've done:

my $style = Wx::TextAttr-new();
$style-Wx::TextAttr::SetTextColour(wxBLUE);
$style-Wx::TextAttr::SetBackgroundColour(wxGREEN);
$style-Wx::TextAttr::SetAlignment(wxTEXT_ALIGNMENT_CENTRE);

Also, do you have any idea if I can use superscripts and subscripts with the 
methods provided by the library?


Thank you.

Octavian

- Original Message - 
From: Mattia Barbon [EMAIL PROTECTED]

To: Octavian Rasnita [EMAIL PROTECTED]
Cc: wxperl-users@perl.org
Sent: Friday, March 21, 2008 7:15 PM
Subject: Re: wxTextAttr



Octavian Rasnita wrote:

  Hi Octavian,

I want to create a readonly multiline rich text control that has the 
wxTE_PROCESS_ENTER style, so I've tried to use

Wx::TextCtrl with the wxTE_RICH2 style.

I need to make some format settings in the control, like the font, the 
color, background-color, boldness and other things like that and I 
thought I can use Wx::TextAttr, but unfortunately I've read that all the 
methods for setting options of this module are not available in WxPerl.


  I think this was true for older wxPerl versions (can't remember how
much old); I use Wx::TextAttr to change font color on a Wx::TextCtrl
created with wxTE_RICH2, so this should work.

Can I make Wx::RichTextCtrl to create readonly controls that can be used 
with the keyboard?
Or can I assign different formats to a Wx::TextCtrl using Wx::TextAttr or 
other methods?


  I do not have much experience with Wx::RichTextCtrl (besides writing
some code for the wxPerl demo), but you should be able to do what you
need using wxTextCtrl.

HTH
Mattia





superscripts - was PDK

2008-03-21 Thread Octavian Rasnita

Hi Mattia and all,

I've finally found how to set the font and its attributes in a rich 
TextCtrl.


The single thing I couldn't find how to do, is to set superscripts and 
subscripts (those small letters up or down the line of text).


If you know how to do this, or at least if you know that it is possible to 
do that with WxPerl, please tell me.


Thank you.

Octavian



wxTextAttr

2008-03-20 Thread Octavian Rasnita

Hi,

I want to create a readonly multiline rich text control that has the 
wxTE_PROCESS_ENTER style, so I've tried to use

Wx::TextCtrl with the wxTE_RICH2 style.

I need to make some format settings in the control, like the font, the 
color, background-color, boldness and other things like that and I thought I 
can use Wx::TextAttr, but unfortunately I've read that all the methods for 
setting options of this module are not available in WxPerl.


I've seen in the demo module that the Wx::RichText extension is used instead 
and I thought I could use it instead of Wx::TextCtrl.


Unfortunately I can't use a RichTextCtrl object with the keyboard, because 
if I use the arrow up or arrow down, instead of moving the cursor to the 
next or previous line, it moves to the previous or next control.
And I've also seen that the wxTE_READONLY style seems to not work with 
Wx::RichTextCtrl.


What is your advice in this regard?

It would be wonderful if I could assign a pre-created RTF string to the 
control, because I would be able to use more formats which are allowed by 
RTF specifications, since I might need to also use subscripts, superscripts, 
etc.
But even if it is possible to add and format text only by using different 
methods, please tell me how can I do what I want.


Can I make Wx::RichTextCtrl to create readonly controls that can be used 
with the keyboard?
Or can I assign different formats to a Wx::TextCtrl using Wx::TextAttr or 
other methods?


Sorry for so many questions, but I couldn't find documentation about these 
things anywhere.


Thank you.

Octavian



PAR

2008-03-19 Thread Octavian Rasnita

Hi,

Is it possible to use PAR under Windows to create a .par file with a program 
that uses WxPerl that can be ran under Linux?


Thanks.

Octavian



Re: printing a text in the status bar for menu items that havesubmenus

2008-03-09 Thread Octavian Rasnita

From: bungsuputra linan [EMAIL PROTECTED]

Hi Octavian Rasnita,

I am not sure whether you have tried this, but it works fine in my
script. I mean the text is printed in the status bar for menus with
submenus. I hope I get what you meant in your previous email correctly.

self-{OptionsMenu}-Append(-1, When searching with special chars,
$self-{CautaDiaMenu}, Text to appear in the status bar);

Hi bungsu,

Thank you but unfortunately it doesn't work this way either.

In fact I have previously tried to add a third parameter to be printed in 
the status bar for common menu items, but it was not printed, as:


$self-{CautaDia1} = $self-{CautaDiaMenu}-AppendRadioItem(-1, Search only 
with special chars, Text to be printed in the status bar);


I don't know what could be wrong. I am using:

This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 50 registered patches, see perl -V for more detail)
Binary build 820 [274739] provided by ActiveState http://www.ActiveState.com
Built Jan 23 2007 15:57:46

Wx version 0.80.45.16

Thank you.

Octavian 



printing a text in the status bar for menu items that have submenus

2008-03-08 Thread Octavian Rasnita

Hi,

I am trying to print a text in the status bar for each menu item, including 
the menu items that have submenus, but for those items I can't do it.
For the common menu items (button, radio or checkboxes), the text is printed 
well in the status bar.


I have tried something like:

#define the menu
$self-{OptionsMenu} = Wx::Menu-new();

#Define the submenu
$self-{CautaDiaMenu} = Wx::Menu-new();

#then append some items to that menu
$self-{CautaDia1} = $self-{CautaDiaMenu}-AppendRadioItem(-1, Caută doar 
cu diacritice);


#Append the submenu to its parent menu
$self-{OptionsMenu}-Append(-1, When searching with special chars, 
$self-{CautaDiaMenu});


#handle the event
EVT_MENU_HIGHLIGHT($self, $self-{CautaDiaMenu}, 
sub{$_[0]-{StatusBar}-SetStatusText(...)});


But nothing happens when selecting that menu item.
So I have also tried to get the result of the Append method:

$self-{CautaDia} = $self-{OptionsMenu}-Append(-1, When searching with 
special chars, $self-{CautaDiaMenu});


and

EVT_MENU_HIGHLIGHT($self, $self-{CautaDia}, 
sub{$_[0]-{StatusBar}-SetStatusText(...)});


But it doesn't work either.
Please tell me what I am doing wrong.

Is it possible to print texts in the status bar when selecting the menus 
that have submenus?


Thank you.

Octavian



Wx::Sound solved

2008-02-26 Thread Octavian Rasnita

Hi,

Sorry for my previous message.

I've forgotten to add a -new in order to write:

Wx::Sound-new(file.wav)-Play();

Octavian



wxToolBar

2008-02-22 Thread Octavian Rasnita

Hi,

I've read the following in the chm docs of WxPerl:


wxToolBar::InsertTool
wxPerl note: This method is not implemented in wxPerl


But I've finally seen that it is available in WxPerl so I have an older chm 
file.


Is there  a newer one that's updated?

Thanks.

Octavian



Re: wxToolBar:InsertTool - don't use, it's buggy

2008-02-22 Thread Octavian Rasnita

From: Daniel [EMAIL PROTECTED]


Hi,


I don't know if there's a newer documentation, but I know there is a bug 
in wxToolBar::InsertTool.
If you insert a tool, the toolbar changes its size to the width of the 
tools. That means, it has no longer the width of the window and that 
doesn't look good.  You can see this behaviour  in the toolbar.pl sample.

So I do not use it, but I would like to do.
Regards
Daniel


Oh, unfortunately I am blind and I can't see if the image of the widgets 
look right on the screen.
But thank you for letting me know about this, and if somebody else knows the 
right way, please let us know.


Thanks.

Octavian



Re: using a progress bar with POE::Loop::Wx

2008-02-10 Thread Octavian Rasnita
Ok, thanks.

I've finally used

Wx::SafeYield($Window);

in the loop, and now the window is just a little bit more responsive.

Octavian

  - Original Message - 
  From: Mike Schroeder 
  To: Octavian Rasnita ; wxperl-users@perl.org 
  Sent: Sunday, February 10, 2008 6:34 PM
  Subject: Re: using a progress bar with POE::Loop::Wx


  Using POE is not something you do for just one thing, it affects the whole 
way you would code your app, so you would use POE to do non-blocking file 
transfer (using something like POE::Component::Client::FTP), and use POE to do 
non-blocking DBI updates (using something like POE::Component::SimpleDBI).  It 
doesn't really work to use POE for just one thing in your app -- to take 
advantage of POE, you either embrace it for everything or don't use it at all.  
YMMV.



  On 2/10/08, Octavian Rasnita [EMAIL PROTECTED] wrote:
Hi Mark,

Thank you for your help and for some clarifications.
I didn't know that cooperative multitasking doesn't imply multithreading.

But in this case I am not sure that POE can help me to do what I want. The 
ProgressDialog is not responsive not because updating the progress bar takes 
much processor time, but because the file download and database updates does 
that.

If POE can't do the file upload and the database update in a separate 
thread but in the main thread, the one that manages the GUI, then the GUI will 
be unresponsive.

The file upload and database update are continuous tasks, and I cannot put 
a subroutine to do something from 5 to 5 seconds in order to do the file 
download, and now I do something like:

create the ProgressDialog window

while downloading the file
save the current buffer to the hard disk
update the ProgressDialog window
end the file download

close the ProgressDialog window

Well, with POE I can update the ProgressDialog separately, but until the 
file finishes to download, the current window of the program will be 
unresponsive.

With Win32::GUI I can insert the following line in the loop, and then the 
GUI will be much responsive, but I don't know if there is such a thing in 
WxPerl:

Win32::GUI::DoEvents() = 0 or die Window was closed during processing;

Do you know by chance if there is a method that makes WxPerl to handle the 
events in the queue before passing to the next step in the loop?

Thank you.

Octavian

  - Original Message - 
  From: Mike Schroeder 
  To: Octavian Rasnita 
  Sent: Saturday, February 09, 2008 9:00 PM
  Subject: Re: using a progress bar with POE::Loop::Wx


  First, with POE, I don't think this would be another thread.  POE uses 
cooperative multi-tasking, not threads.

  We use two different approaches -- polling a remote job for its progress, 
and reacting to local events.

  In our case, we made a Panel that holds the Gauge and some StaticText 
controls to display extra info.

  The Panel in turn has a StartPolling method which starts off a POE 
event to fetch remote job data, and calls itself again every 5 seconds until 
the job is complete.  Here is some stripped down psuedo code:


  sub StartPolling {
 # Gather Args
 # Start a POE event to GetData (results will go to ReceiveData)
 # delay_set('StartPolling', 5);
  }



  Depending on how abstracted your environment is, you may have POE stuff 
in here or not.  In our case, we don't.

  The Panel also has a ReceiveData method which either receives the data 
from the polling events, *or* can receive data directly from a local event.  
Here is some code again -- hopefully it makes sense :)


  sub ReceiveData {
 my ( $self, $data )  = @_;

 Wx::LogVerbose(Progress ReceiveData: $self  . Dumper $data );

 unless ( $self-{_first_data} ) {
$self-{progress_gauge}-SetRange( $data-{expected} );
$self-{_first_data} = 1;
 }

 if ( $data-{status} eq 'C' ) {
Wx::LogVerbose(Job $data-{job_id} is Complete);
# job is done
$self-_update_data( $data );
if ( ref $self-{_on_complete} eq 'CODE' ) {
   { $self-{_on_complete} } (
 DATA= $data,
 CONTROL = $self,
 FRAME   = $self-GetTopLevelParent()
 );
}

if ( $self-{_close_on_complete} ) {
   $self-GetTopLevelParent()-Close();
} else {
   # stop polling - happens automatically when frame closed
   $self-GetTopLevelParent()-unregister_control(
cachekey = $self-{_cache_key},
control  = $self );
}
 } elsif ( $data-{status} eq 'R' ) {
Wx::LogVerbose(Job $data-{job_id} is Running);
# job is running
$self-_update_data

using a progress bar with POE::Loop::Wx

2008-02-09 Thread Octavian Rasnita

Hi,

I want to use a ProgressDialog to show the progress of a file download and 
database update.
The progress works well, however the ProgressDialog window is very 
unresponsive because the program uses a single thread.


Is it possible to use POE::Loop::Wx for making the dialog window more 
responsive?

Or is there another better method for doing this?

In the POE::Loop::Wx examples I've seen that it can be used for making 
asynchronious requests, but those requests were made automaticly, after a 
certain number of seconds which were defined in the POE::Session. The 
requests that were made at a certain command (a button click) were made in 
the main thread of the program.


I need to run the subroutine that does the ProgressDialog update with some 
parameters and only after a certain part of the file was downloaded or a 
certain number of records were inserted in the database.


Please tell me if I can find an example of using a progress bar that uses a 
separate thread for doing this.


Or if it is better to use the main thread for update the ProgressDialog and 
a second thread for doing the file download and database update, please give 
me some hints about how to do that with POE::Loop::Wx or another method that 
can allow the 2 threads to communicate.


Thank you.

Octavian



more info regarding running an WxPerl executable

2008-02-02 Thread Octavian Rasnita

Hi,

I've discovered something very strange.

If I run the WxPerl executable created with PDK, no files are extracted in 
the temp directory.
But if I right-click the file, chose Properties, and from the 
compatibility tab I chose Win 95 or 98/Millenium, after running the 
executable again, 10 dll files are extracted in the temp directory.


The program still doesn't run, but this time at least those files are 
extracted.


Have you seen this thing before?

Thank you for any idea.

Octavian



Style

2008-01-27 Thread Octavian Rasnita

   Hi,

Is it possible to change the foreground/background of some words from a text 
from a TextCtrl control without re-writing the whole text?


I am thinking to change the background of the words which I move the mouse 
cursor over, but if I would need to re-write the whole text, I think the 
text might flicker if the user will move the mouse very fast...


Thanks.

Octavian



beep

2008-01-10 Thread Octavian Rasnita

Hi,

Does WxPerl have a method for making a default beep?

I need something like Win32::GUI::MessageBeep that can be used in a 
Win32::GUI application.


Thank you.

Octavian



Multiline text controls indices

2008-01-08 Thread Octavian Rasnita

Hi,

I want to make a TextCtrl widget and when I double click with the mouse 
somewhere in the text it should get the whole word that was clicked.


I've done the following in the OnWidget_Click event handler:

my $text = $self-GetValue();

my ($result, $x, $y) = $self-Wx::TextCtrlBase::HitTest([$event-GetX, 
$event-GetY]);


my $position = $self-XYToPosition($x, $y);

my $start = rindex($text,  , $position) + 1; #get the start of word
my $end = index($text,  , $position) - 1; #get the end of word
my $selection = substr($text, $start, $end - $start + 1); #get the text of 
the word


Wx::MessageBox($position, $start, $end, \$selection\, ok, wxOK, 
$self);


The program works, but not always. This is because:


The multiline text controls always store the text as a sequence of lines 
separated by \n characters, i.e. in the Unix text format even on non-Unix 
platforms.
This allows the user code to ignore the differences between the platforms 
but at a price: the indices in the control such as those returned by

GetInsertionPoint
or
GetSelection
can not be used as indices into the string returned by
GetValue
as they're going to be slightly off for platforms using \r\n as separator 
(as Windows does), for example.


Instead, if you need to obtain a substring between the 2 indices obtained 
from the control with the help of the functions mentioned above, you should 
use

GetRange.
And the indices themselves can only be passed to other methods, for example
SetInsertionPoint
or
SetSelection.

To summarize: never use the indices returned by (multiline) wxTextCtrl as 
indices into the string it contains, but only as arguments to be passed back 
to

the other wxTextCtrl methods.


Well, in this case I need to get the position of the first space char before 
the character that was clicked and the position of the first space char 
after it (for delimiting the word), for beeing then able to get the word.


But I don't know how to do this if I can't use those indices in the string 
contained by the TextCtrl widget.
I guess WxPerl doesn't have methods for getting the first previous and next 
space or for selecting the word that contains a certain char...


Do you have any better idea?

Thank you.

Octavian



wxChoice

2008-01-05 Thread Octavian Rasnita

Hi,

Please tell me where can I found more information about the methods that can 
be used for using a wxChoice widget.
I've seen that in the chm wxWidgets reference there are very few methods 
described in the page about wxChoice.


And I want to know how can I get the text of the selected item, its index, 
how to select a certain item by code, how to count the number of items, and 
other things like these.


I know only that I can get the index of the selected item in the event 
handler fired by an EVT_CHOICE, using $event-GetInt(), but I want to be 
able to get the text of the selected item in other subroutines also.

(I hope it is possible).

Thank you.

Octavian



Finding the char position

2008-01-03 Thread Octavian Rasnita

Hello and I wish you a happy new year!

If I click in a multi line text control with the mouse, how can I find at 
which position I have clicked on?


I've read about the text control object methods, but I couldn't find how to 
do that.


Thank you.

Octavian



event

2007-12-01 Thread Octavian Rasnita

Hello,

I have a multiline text field with a text in it, and I want to allow the 
users to double click a word and an event should be fired in that moment, 
and then I want to be able to get the word that was clicked in the event 
handler.


When the word is double-clicked, it is highlighted automaticly, and I might 
be able to get that selected text from the text field, or maybe the 
word-selection occurs after the event is fired, and in that case I might 
need to be able to get the character ID on the position where the click was 
made.


Please tell me what event can I use to detect the double click in an edit 
field, and what method could I use to find the selected word... if it is 
possible.


Thank you.

Octavian



  1   2   >