RE: Vaiidators

2013-02-15 Thread steveco.1959
Hi James, 

  Here's what I have working for a custom dialog with a text validator.
Probably a cleaner way to do some of it, but one step at a time. :)

It's cool, sadly, I don't think you can do any more with validator.
 
You should be able to do most of your layout with sizers.  I'm afraid they
are a bit painful, but they will automatically scale depending on your
screen resolution.
 
You can automatically generate them in a number of languages including Perl
with wxGlade (which is a Python app).
 
Good luck,
 
Steve.


Re: Vaiidators

2013-02-14 Thread James Lynes
Steve:

Here's what I have working for a custom dialog with a text validator.
Probably a cleaner way to do some of it, but one step at a time. :)

Thanks to all for their suggestions.

James
(also posted to github)

On Thu, Feb 14, 2013 at 12:10 AM, James Lynes jmlyne...@gmail.com wrote:

 I have a working version and will post it after some sleep.
 James


 On Wed, Feb 13, 2013 at 11:21 AM, James Lynes jmlyne...@gmail.com wrote:

 Steve:

 Looks like your example matches up with Johan's suggestion. I'll try a
 character class.

 Thanks, for your response.

 James



 On Wed, Feb 13, 2013 at 6:36 AM, steveco.1...@gmail.com wrote:

  I am playing with creating a custom dialog using validators and I seem
 to
  have hit a wall. I am using the code from the wxPerl demo program.

 I've just checked my old code and the best I got was:

 my $regex = [\d\.];

 Steve






LCDAlarmClockDialog.pm
Description: Binary data


LCDAlarmClockDialog.pl
Description: Binary data


Re: Vaiidators

2013-02-13 Thread James Lynes
Johan:

Thanks for the hint. I will give it a try.

Are validators not used very often? If multiple values need to be returned
from a custom dialog, is a hash reference used to return the values or do
you use multiple validators?

Maybe someone has a complete custom dialog they can post.

James


On Wed, Feb 13, 2013 at 2:43 AM, Johan Vromans jvrom...@squirrel.nl wrote:

 James Lynes jmlyne...@gmail.com writes:

  print Dumper($timeval) says:
  $VAR1 = bless( {
   'data' = \'10:00',
   'validate' = qr/(?^:(\d+:))/
 }, 'LCDAlarmClockDialog::Validator' );
 
  1. Not sure what the pre-pended ?^: means. It was added by
  Wx::Perl::TextValidator
 
  2. I have tried a number of regex strings:
(\d+)  allows entry of numbers
(:)  allows entry of colons
(\d+:) allows no entry at all
   (\d+:\d+) allows no entry at all
   (\d{2,}:\d{2,})allows no entry at all
 

 It's a long time ago that I playes with Validators, but I seem to recall
 that there was something with the moment the test was applied.
 The validator is really a filter, so it restrics what characters can be
 input. When you try (\d+:) then youy're matching more than one character
 against the input, which will always fail since the input initially is
 empty and the first character will never match the pattern.

 So the validator pattern should be sort of character class, e.g. [\d:]
 and you need an additional end-form validator ^(\d{2,}:\d{2,})$ in
 TransferFromWindow.

 -- Johan



Re: Vaiidators

2013-02-13 Thread James Lynes
Steve:

Looks like your example matches up with Johan's suggestion. I'll try a
character class.

Thanks, for your response.

James


On Wed, Feb 13, 2013 at 6:36 AM, steveco.1...@gmail.com wrote:

  I am playing with creating a custom dialog using validators and I seem to
  have hit a wall. I am using the code from the wxPerl demo program.

 I've just checked my old code and the best I got was:

 my $regex = [\d\.];

 Steve




Re: Vaiidators

2013-02-13 Thread James Lynes
I have a working version and will post it after some sleep.
James

On Wed, Feb 13, 2013 at 11:21 AM, James Lynes jmlyne...@gmail.com wrote:

 Steve:

 Looks like your example matches up with Johan's suggestion. I'll try a
 character class.

 Thanks, for your response.

 James



 On Wed, Feb 13, 2013 at 6:36 AM, steveco.1...@gmail.com wrote:

  I am playing with creating a custom dialog using validators and I seem
 to
  have hit a wall. I am using the code from the wxPerl demo program.

 I've just checked my old code and the best I got was:

 my $regex = [\d\.];

 Steve





RE: Vaiidators

2013-02-12 Thread steveco.1959
Hi James,

 I want to enter a time of day value such as ##:## and ensure the colon
 was entered.

I'd live to hear if you manage to do this.


2. I have tried a number of regex strings:
  (\d+)  allows entry of numbers
  (:)  allows entry of colons
  (\d+:) allows no entry at all
 (\d+:\d+) allows no entry at all
 (\d{2,}:\d{2,})allows no entry at all

Do validators not allow for mixed alphanumeric fields? Seems like a
common need.

I only managed to get a one character code, like \d+.

But the whole concept of these transfer buffers seemed a bit
counter-intuitive and old-school to me and so I didn't try very hard.

Let me know if you crack it.  As I'm writing this, I realise I never used
any regex feedback like \1 or whatever.

Good luck,

Regards

Steve.



Re: Vaiidators

2013-02-12 Thread Sergei Steshenko




- Original Message -
 From: James Lynes jmlyne...@gmail.com
 To: wxperl-users@perl.org
 Cc: 
 Sent: Monday, February 11, 2013 2:15 AM
 Subject: Vaiidators
 
 Hi:
 
 I am playing with creating a custom dialog using validators and I seem to
 have hit a wall. I am using the code from the wxPerl demo program.
 
 My setup is:
     my $timeval = LCDAlarmClockDialog::Validator-new( qr/(\d+)/,
 \($self-{data}) );
 
     I want to enter a time of day value such as ##:## and ensure the colon
 was entered.
 
 print Dumper($timeval) says:
     $VAR1 = bless( {
                  'data' = \'10:00',
                  'validate' = qr/(?^:(\d+:))/
                }, 'LCDAlarmClockDialog::Validator' );
 
 1. Not sure what the pre-pended ?^: means. It was added by
 Wx::Perl::TextValidator
 
 2. I have tried a number of regex strings:
       (\d+)              allows entry of numbers
       (:)                  allows entry of colons
       (\d+:)             allows no entry at all
      (\d+:\d+)         allows no entry at all
      (\d{2,}:\d{2,})    allows no entry at all
 
     Do validators not allow for mixed alphanumeric fields? Seems like a
 common need.
     If they do, how do you structure it?
 
 Thanks, James
 

I don't know wxPerl specifics, but how about a very basic regular expression:

^(\d+)\:(\d+)$

?

Try this in a junk script first.

Regards,
  Sergei.



Re: Vaiidators

2013-02-12 Thread Johan Vromans
James Lynes jmlyne...@gmail.com writes:

 print Dumper($timeval) says:
 $VAR1 = bless( {
  'data' = \'10:00',
  'validate' = qr/(?^:(\d+:))/
}, 'LCDAlarmClockDialog::Validator' );

 1. Not sure what the pre-pended ?^: means. It was added by
 Wx::Perl::TextValidator

 2. I have tried a number of regex strings:
   (\d+)  allows entry of numbers
   (:)  allows entry of colons
   (\d+:) allows no entry at all
  (\d+:\d+) allows no entry at all
  (\d{2,}:\d{2,})allows no entry at all


It's a long time ago that I playes with Validators, but I seem to recall
that there was something with the moment the test was applied. 
The validator is really a filter, so it restrics what characters can be
input. When you try (\d+:) then youy're matching more than one character
against the input, which will always fail since the input initially is
empty and the first character will never match the pattern.

So the validator pattern should be sort of character class, e.g. [\d:]
and you need an additional end-form validator ^(\d{2,}:\d{2,})$ in
TransferFromWindow.

-- Johan