[rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-27 Thread Mark Dootson via RT
Mon Oct 27 15:05:08 2014: Request 99607 was acted upon.
Transaction: Correspondence added by MDOOTSON
   Queue: Wx
 Subject: Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Hi,

Your issue with Wx::TextEntryBox arises from the basic way wxWidgets handles 
applications and windows.

The basic rule is that the main application loop will exit when no more 
instances of Wx::TopLevelWindow ( e.g. Wx::Frame and Wx::Dialog ) exist in the 
application.

Top level windows (Frames and Dialogs) must be explicitly destroyed.

$dialog_Destroy;

unless your code causes them to be destroyed by some other method (such as 
being a child of another TopLevelWindow when it is destroyed or the automatic 
behaviour when you close the window using system menus / buttons).

In your example, none of these things happens so the application loop never 
exits. Your Wx::TextEntryDialog has no parent so continues to exist after you 
close your Frame.

Dialogs designed for modal usage, such as Wx::TextEntryDialog, need to have a 
valid parent to work properly, or be created as  a special case without a 
parent.

When you create the dialog and pass in the Wx::Panel as the parent the 
following things happen.

Dialogs need top level parents so the wxWidgets code determines the parent of 
Wx::Panel - your frame - and checks if that is a valid parent. It isn't - a 
parent top level window needs to be visible on the display to be a valid parent 
for a dialog. So the dialog is created without a parent. When you close the 
$frame, the TextEntryDialog is left hanging around so the main application loop 
never exits.

In this situation, wxWidgets will use anything you have set as the top window 
(wxTheApp-SetTopWindow) but your example does not do this.

In standard usage you would always do:

my $dialog = Wx::textEntryDialog-new();
my $result = $dialog-ShowModal;
# .. get stuff from dialog
$dialog-Destroy;

so your particular issue would not arise.

With regard to the different in implementation between Wx:TextEntryDialog and 
Wx::SingleChoiceDialog, it is indeed because of the use of client data. The 
wxPerl implementation allows you to pass a reference to an array of anything 
(so maybe references to objects) so a C++ class is required to maintain the 
correct reference counts on the Perl SVs for the array ref.

Hope it helps

Mark
















 






Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-27 Thread Patrick via RT
Mon Oct 27 18:31:41 2014: Request 99607 was acted upon.
Transaction: Correspondence added by pwnbusiness2...@centurylink.net
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: rejected
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Thanks.  Yes that helps.  So you are saying that I should wait until I call 
a subroutine to actually create a new instance of the TextEntryDialog.  That 
way the panel would already be visible and would therefore be a valid 
parent?

- Original Message - 
From: Mark Dootson via RT bug...@rt.cpan.org
To: pwnbusiness2...@centurylink.net
Sent: Monday, October 27, 2014 3:05 PM
Subject: [rt.cpan.org #99607] Issue using wxTextEntryBox


 URL: https://rt.cpan.org/Ticket/Display.html?id=99607 

 Hi,

 Your issue with Wx::TextEntryBox arises from the basic way wxWidgets 
 handles applications and windows.

 The basic rule is that the main application loop will exit when no more 
 instances of Wx::TopLevelWindow ( e.g. Wx::Frame and Wx::Dialog ) exist in 
 the application.

 Top level windows (Frames and Dialogs) must be explicitly destroyed.

 $dialog_Destroy;

 unless your code causes them to be destroyed by some other method (such as 
 being a child of another TopLevelWindow when it is destroyed or the 
 automatic behaviour when you close the window using system menus / 
 buttons).

 In your example, none of these things happens so the application loop 
 never exits. Your Wx::TextEntryDialog has no parent so continues to exist 
 after you close your Frame.

 Dialogs designed for modal usage, such as Wx::TextEntryDialog, need to 
 have a valid parent to work properly, or be created as  a special case 
 without a parent.

 When you create the dialog and pass in the Wx::Panel as the parent the 
 following things happen.

 Dialogs need top level parents so the wxWidgets code determines the parent 
 of Wx::Panel - your frame - and checks if that is a valid parent. It 
 isn't - a parent top level window needs to be visible on the display to be 
 a valid parent for a dialog. So the dialog is created without a parent. 
 When you close the $frame, the TextEntryDialog is left hanging around so 
 the main application loop never exits.

 In this situation, wxWidgets will use anything you have set as the top 
 window (wxTheApp-SetTopWindow) but your example does not do this.

 In standard usage you would always do:

 my $dialog = Wx::textEntryDialog-new();
 my $result = $dialog-ShowModal;
 # .. get stuff from dialog
 $dialog-Destroy;

 so your particular issue would not arise.

 With regard to the different in implementation between Wx:TextEntryDialog 
 and Wx::SingleChoiceDialog, it is indeed because of the use of client 
 data. The wxPerl implementation allows you to pass a reference to an array 
 of anything (so maybe references to objects) so a C++ class is required to 
 maintain the correct reference counts on the Perl SVs for the array ref.

 Hope it helps

 Mark




















 


---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com




Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-22 Thread Patrick via RT
Wed Oct 22 08:50:34 2014: Request 99607 was acted upon.
Transaction: Correspondence added by pwnbusiness2...@centurylink.net
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Just from a quick look over a few things, it looks like the only difference in 
is that the wxSingleChoiceDialog XS(?) file handles client data or if client 
data is not present, an overloading situation exits.  It may be a problem in 
wxWidgets itself and not in wxperl.

- Original Message -
From: Steve Cookson - gmail via RT bug...@rt.cpan.org
To: pwnbusiness2...@centurylink.net
Sent: Tuesday, October 21, 2014 4:38:25 PM
Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

URL: https://rt.cpan.org/Ticket/Display.html?id=99607 

Hi Patrick,

On 21-10-2014 21:16, Patrick via RT wrote:
 Thanks for the reply, Steve.  I can see what you are saying.  I have C and 
 some slight C++ experience from years ago.  It was just when OOP was starting 
 to take off.  I'd be glad to try to get oriented enough that I could make a 
 little contribution, but right now I'm a little disoriented in the syntax and 
 protocol of the open-source contribution system not to mention the wxperl 
 contribution system.
Your not alone in that! wxPerl has been more organised in the past, but 
we've been through a bit of a hiatus this year and we're still trying to 
pull ourselves together.
 What file is the wxTextEntryDialog code in?
wxPerl::XS::TextEntryDialog.xs

 I can see the wxSingleChoiceDialog that you are speaking of.
wxPerl::XS::SingleChoiceDialog.xs
wxPerl::cpp::SingleChoiceDialog.

But there are many other references to all these files across the 
directories in MANIFEST files, Makefile files and typemap files among 
others.

There are some descriptions about how it all hangs together on the wiki, 
here:

http://wiki.wxperl.nl/Main_Page

especially the first two items:

here:

http://wiki.wxperl.nl/NewClass

and here:

http://wiki.wxperl.nl/Internals_-_Introduction_to_Wx_XS_Wrappers

Good luck.

Regards

Steve




Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-22 Thread Patrick via RT
Wed Oct 22 08:55:14 2014: Request 99607 was acted upon.
Transaction: Correspondence added by pwnbusiness2...@centurylink.net
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


(repost)
Just from a quick look over a few things, it looks like the only difference in 
them is that the wxSingleChoiceDialog XS(?) file handles client data or if 
client data is not present, an overloading situation exists.  It may be a 
problem in wxWidgets itself and not in wxperl.

- Original Message -
From: Patrick pwnbusiness2...@centurylink.net
To: bug...@rt.cpan.org
Sent: Tuesday, October 21, 2014 4:15:57 PM
Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

Thanks for the reply, Steve.  I can see what you are saying.  I have C and some 
slight C++ experience from years ago.  It was just when OOP was starting to 
take off.  I'd be glad to try to get oriented enough that I could make a little 
contribution, but right now I'm a little disoriented in the syntax and protocol 
of the open-source contribution system not to mention the wxperl contribution 
system.  What file is the wxTextEntryDialog code in?  I can see the 
wxSingleChoiceDialog that you are speaking of.

- Original Message -
From: Steve Cookson via RT bug...@rt.cpan.org
To: pwnbusiness2...@centurylink.net
Sent: Tuesday, October 21, 2014 3:43:42 PM
Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

URL: https://rt.cpan.org/Ticket/Display.html?id=99607 

Hi Patrick,

On 21-10-2014 17:06, Patrick via RT wrote:
   When I create a wxSingleChoiceDialog, that does show up as a child.  Why is 
 the handling of these two different?
Well, the implementation of the wxSingleChoiceDialog is much more 
complicated. You can look in wxPerl::XS. Here isTextEntryBox:

wxTextEntryDialog::new( parent, message, caption =
wxGetTextFromUserPromptStr, defaultValue = wxEmptyString, style =
wxTextEntryDialogStyle, pos = wxDefaultPosition )
 wxWindow* parent
 wxString message
 wxString caption
 wxString defaultValue
 long style
 wxPoint pos


and here is wxSingleChoiceDialog:

wxSingleChoiceDialog::new( parent, message, caption, chs, dt =
PL_sv_undef, style = wxCHOICEDLG_STYLE, pos = wxDefaultPosition )
 wxWindow* parent
 wxString message
 wxString caption
 SV* chs
 SV* dt
 long style
 wxPoint pos
   PREINIT:
 wxString* choices;
 SV** data;
 int n, n2;
   CODE:
 n = wxPli_av_2_stringarray( aTHX_ chs, choices );
 if( !SvOK( dt ) )
 {
   RETVAL = new wxPliSingleChoiceDialog( parent, message,
caption, n,
 choices, 0, style, pos );
 }
 else
 {
   n2 = wxPli_av_2_svarray( aTHX_ dt, data );
   if( n != n2 )
   {
 delete[] choices;
 delete[] data;
 choices = 0; data = 0; n = 0;
 croak( supplied arrays of different size );
   }
   RETVAL = new wxPliSingleChoiceDialog( parent, message,
caption, n,
 choices, data, style, pos );
   delete[] data;
 }
 delete[] choices;
   OUTPUT:
 RETVAL

wxSingleChoiceDialog has a whole new .cpp function 
(wxPliSingleChoiceDialog) written within wxPerl.  It also has a 
destructor there.  It is one of only 7 .cpps. It's not clear to me how 
the destructor it is called, but the two functions are implemented very 
differently.

It would be good to understand why they are different and bring them 
into line with each other.

Regards,

Steve.









[rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Erik Colson via RT
Tue Oct 21 02:26:08 2014: Request 99607 was acted upon.
Transaction: Correspondence added by ecocode
   Queue: Wx
 Subject: Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: new
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Hi Patrick,

Add this line after the dialog creation and try again. You might understand 
what is happening.

$dialog-Show(1);

-- 
Erik


Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Steve Cookson

Hi Patrick,

On 21-10-2014 00:52, Patrick via RT wrote:

my $self = $ref-SUPER::new( undef,
1,
'Parent Window',
Wx::wxDefaultPosition,
[500, 500],
);
my $panel = Wx::Panel-new( $self,
2
);
If you use -1 (or wxID_ANY) as the widget ID, it will assign the next 
free identifier. Then you don't have to keep track of what has already 
been used.


Regards,

Steve.


Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Steve Cookson via RT
Tue Oct 21 04:00:48 2014: Request 99607 was acted upon.
Transaction: Correspondence added by steve.cook...@sca-uk.com
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Hi Patrick,

On 21-10-2014 00:52, Patrick via RT wrote:
 my $self = $ref-SUPER::new( undef,
 1,
 'Parent Window',
 Wx::wxDefaultPosition,
 [500, 500],
 );
 my $panel = Wx::Panel-new( $self,
 2
 );
If you use -1 (or wxID_ANY) as the widget ID, it will assign the next 
free identifier. Then you don't have to keep track of what has already 
been used.

Regards,

Steve.



[rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Erik Colson via RT
Tue Oct 21 04:20:44 2014: Request 99607 was acted upon.
Transaction: Correspondence added by ecocode
   Queue: Wx
 Subject: Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


On Tue Oct 21 02:26:08 2014, ecocode wrote:
 Hi Patrick,
 
 Add this line after the dialog creation and try again. You might
 understand what is happening.
 
 $dialog-Show(1);

I'll explain my point of view on this:

Wx::TextEntryBox is a 'convenience' Dialog which, although 'parent' aught to be 
defined in the constructor, the dialog is not added as a children to the 
parent. Reason for this is that $dialog has no wxwindow ID (look at the 
constructor params). Therefor it can't be added as a children to any wx 
container.  This kind of dialogs are ment to be used in procedures where they 
are shown modally, and then destroyed.

You can use DDP to show the relation to other widgets i.e.:
use DDP;
p $frame-GetChildren;   # should show the panel as a children
p $panel-GetChildren;   # doesn't show the dialog as a children

also try 
p $panel;
p $dialog;

which illustrates the internal difference between both.

In conclusion: destroying $frame destroys $panel, but won't destroy $dialog, 
because it is _not_ the child of $panel.
So, you are on your own to destroy the dialog with

$dialog-Destroy;

you can argue against this behaviour, but this is rather wxwidgets related and 
probably shouldn't be altered in wxPerl, assuming it can be.
-- 
Erik


Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Patrick via RT
Tue Oct 21 08:04:43 2014: Request 99607 was acted upon.
Transaction: Correspondence added by pwnbusiness2...@centurylink.net
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Thanks for the suggestion.  I find it convenient to use explicit identifiers on 
everything since I do need to use explicit identifiers on some things to access 
them in certain situations.  This code sample doesn't reflect that fact, but it 
is a clip from a larger piece.

- Original Message -
From: Steve Cookson via RT bug...@rt.cpan.org
To: pwnbusiness2...@centurylink.net
Sent: Tuesday, October 21, 2014 4:00:48 AM
Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

URL: https://rt.cpan.org/Ticket/Display.html?id=99607 

Hi Patrick,

On 21-10-2014 00:52, Patrick via RT wrote:
 my $self = $ref-SUPER::new( undef,
 1,
 'Parent Window',
 Wx::wxDefaultPosition,
 [500, 500],
 );
 my $panel = Wx::Panel-new( $self,
 2
 );
If you use -1 (or wxID_ANY) as the widget ID, it will assign the next 
free identifier. Then you don't have to keep track of what has already 
been used.

Regards,

Steve.




Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Patrick via RT
Tue Oct 21 08:06:09 2014: Request 99607 was acted upon.
Transaction: Correspondence added by pwnbusiness2...@centurylink.net
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Thanks for the response.  In another piece of code, I actually used a 
ShowModal() call to display the window with the same result.  I think I follow 
what you are saying, and I will give it a try.

- Original Message -
From: Erik Colson via RT bug...@rt.cpan.org
To: pwnbusiness2...@centurylink.net
Sent: Tuesday, October 21, 2014 4:20:44 AM
Subject: [rt.cpan.org #99607] Issue using wxTextEntryBox

URL: https://rt.cpan.org/Ticket/Display.html?id=99607 

On Tue Oct 21 02:26:08 2014, ecocode wrote:
 Hi Patrick,
 
 Add this line after the dialog creation and try again. You might
 understand what is happening.
 
 $dialog-Show(1);

I'll explain my point of view on this:

Wx::TextEntryBox is a 'convenience' Dialog which, although 'parent' aught to be 
defined in the constructor, the dialog is not added as a children to the 
parent. Reason for this is that $dialog has no wxwindow ID (look at the 
constructor params). Therefor it can't be added as a children to any wx 
container.  This kind of dialogs are ment to be used in procedures where they 
are shown modally, and then destroyed.

You can use DDP to show the relation to other widgets i.e.:
use DDP;
p $frame-GetChildren;   # should show the panel as a children
p $panel-GetChildren;   # doesn't show the dialog as a children

also try 
p $panel;
p $dialog;

which illustrates the internal difference between both.

In conclusion: destroying $frame destroys $panel, but won't destroy $dialog, 
because it is _not_ the child of $panel.
So, you are on your own to destroy the dialog with

$dialog-Destroy;

you can argue against this behaviour, but this is rather wxwidgets related and 
probably shouldn't be altered in wxPerl, assuming it can be.
-- 
Erik



Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Steve Cookson - gmail

Hi Eric,
On 21-10-2014 09:20, Erik Colson via RT wrote:

In conclusion: destroying $frame destroys $panel, but won't destroy $dialog, 
because it is_not_  the child of $panel.
So, you are on your own to destroy the dialog with

$dialog-Destroy;

you can argue against this behaviour, but this is rather wxwidgets related and 
probably shouldn't be altered in wxPerl, assuming it can be.
Oh, very cool answer.  Nice logic.  So when you do OK, or Cancel the Box 
is not deleted.


I'm never quite sure when you need to delete it or not.

But when you leave scope, I guess it must be destroyed then?

Like this:

sub dosomething {
$dialog = Wx::TextEntryDialog-new( $panel, 'Please Enter Text', 
'Dialog Header', , wxOK|wxCANCEL, wxDefaultPosition );

$dialog-Show(1);
return;
}

Does it not get destroyed after return?

What difference does Show and ShowModal make?

Regards

Steve.


Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Patrick via RT
Tue Oct 21 09:10:12 2014: Request 99607 was acted upon.
Transaction: Correspondence added by pwnbusiness2...@centurylink.net
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


I tried what you suggested, and nothing changes.  I use a SingleChoiceDialog in 
another program and this works flawlessly.  It seems to be of the same vein as 
the TextEntryBox.  How is the SingleChoiceDialog handled?

- Original Message -
From: Erik Colson via RT bug...@rt.cpan.org
To: pwnbusiness2...@centurylink.net
Sent: Tuesday, October 21, 2014 4:20:44 AM
Subject: [rt.cpan.org #99607] Issue using wxTextEntryBox

URL: https://rt.cpan.org/Ticket/Display.html?id=99607 

On Tue Oct 21 02:26:08 2014, ecocode wrote:
 Hi Patrick,
 
 Add this line after the dialog creation and try again. You might
 understand what is happening.
 
 $dialog-Show(1);

I'll explain my point of view on this:

Wx::TextEntryBox is a 'convenience' Dialog which, although 'parent' aught to be 
defined in the constructor, the dialog is not added as a children to the 
parent. Reason for this is that $dialog has no wxwindow ID (look at the 
constructor params). Therefor it can't be added as a children to any wx 
container.  This kind of dialogs are ment to be used in procedures where they 
are shown modally, and then destroyed.

You can use DDP to show the relation to other widgets i.e.:
use DDP;
p $frame-GetChildren;   # should show the panel as a children
p $panel-GetChildren;   # doesn't show the dialog as a children

also try 
p $panel;
p $dialog;

which illustrates the internal difference between both.

In conclusion: destroying $frame destroys $panel, but won't destroy $dialog, 
because it is _not_ the child of $panel.
So, you are on your own to destroy the dialog with

$dialog-Destroy;

you can argue against this behaviour, but this is rather wxwidgets related and 
probably shouldn't be altered in wxPerl, assuming it can be.
-- 
Erik



Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Patrick via RT
Tue Oct 21 11:15:01 2014: Request 99607 was acted upon.
Transaction: Correspondence added by pwnbusiness2...@centurylink.net
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Isn't the parent parameter in the call to the new method the parent window?

- Original Message -
From: Erik Colson via RT bug...@rt.cpan.org
To: pwnbusiness2...@centurylink.net
Sent: Tuesday, October 21, 2014 4:20:44 AM
Subject: [rt.cpan.org #99607] Issue using wxTextEntryBox

URL: https://rt.cpan.org/Ticket/Display.html?id=99607 

On Tue Oct 21 02:26:08 2014, ecocode wrote:
 Hi Patrick,
 
 Add this line after the dialog creation and try again. You might
 understand what is happening.
 
 $dialog-Show(1);

I'll explain my point of view on this:

Wx::TextEntryBox is a 'convenience' Dialog which, although 'parent' aught to be 
defined in the constructor, the dialog is not added as a children to the 
parent. Reason for this is that $dialog has no wxwindow ID (look at the 
constructor params). Therefor it can't be added as a children to any wx 
container.  This kind of dialogs are ment to be used in procedures where they 
are shown modally, and then destroyed.

You can use DDP to show the relation to other widgets i.e.:
use DDP;
p $frame-GetChildren;   # should show the panel as a children
p $panel-GetChildren;   # doesn't show the dialog as a children

also try 
p $panel;
p $dialog;

which illustrates the internal difference between both.

In conclusion: destroying $frame destroys $panel, but won't destroy $dialog, 
because it is _not_ the child of $panel.
So, you are on your own to destroy the dialog with

$dialog-Destroy;

you can argue against this behaviour, but this is rather wxwidgets related and 
probably shouldn't be altered in wxPerl, assuming it can be.
-- 
Erik



Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Patrick via RT
Tue Oct 21 12:06:09 2014: Request 99607 was acted upon.
Transaction: Correspondence added by pwnbusiness2...@centurylink.net
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


I ran it with Data Dumper.  $dialog does not show up as a child.  When I create 
a wxSingleChoiceDialog, that does show up as a child.  Why is the handling of 
these two different?

- Original Message -
From: Erik Colson via RT bug...@rt.cpan.org
To: pwnbusiness2...@centurylink.net
Sent: Tuesday, October 21, 2014 4:20:44 AM
Subject: [rt.cpan.org #99607] Issue using wxTextEntryBox

URL: https://rt.cpan.org/Ticket/Display.html?id=99607 

On Tue Oct 21 02:26:08 2014, ecocode wrote:
 Hi Patrick,
 
 Add this line after the dialog creation and try again. You might
 understand what is happening.
 
 $dialog-Show(1);

I'll explain my point of view on this:

Wx::TextEntryBox is a 'convenience' Dialog which, although 'parent' aught to be 
defined in the constructor, the dialog is not added as a children to the 
parent. Reason for this is that $dialog has no wxwindow ID (look at the 
constructor params). Therefor it can't be added as a children to any wx 
container.  This kind of dialogs are ment to be used in procedures where they 
are shown modally, and then destroyed.

You can use DDP to show the relation to other widgets i.e.:
use DDP;
p $frame-GetChildren;   # should show the panel as a children
p $panel-GetChildren;   # doesn't show the dialog as a children

also try 
p $panel;
p $dialog;

which illustrates the internal difference between both.

In conclusion: destroying $frame destroys $panel, but won't destroy $dialog, 
because it is _not_ the child of $panel.
So, you are on your own to destroy the dialog with

$dialog-Destroy;

you can argue against this behaviour, but this is rather wxwidgets related and 
probably shouldn't be altered in wxPerl, assuming it can be.
-- 
Erik



Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Steve Cookson via RT
Tue Oct 21 15:43:41 2014: Request 99607 was acted upon.
Transaction: Correspondence added by steve.cook...@sca-uk.com
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Hi Patrick,

On 21-10-2014 17:06, Patrick via RT wrote:
   When I create a wxSingleChoiceDialog, that does show up as a child.  Why is 
 the handling of these two different?
Well, the implementation of the wxSingleChoiceDialog is much more 
complicated. You can look in wxPerl::XS. Here isTextEntryBox:

wxTextEntryDialog::new( parent, message, caption =
wxGetTextFromUserPromptStr, defaultValue = wxEmptyString, style =
wxTextEntryDialogStyle, pos = wxDefaultPosition )
 wxWindow* parent
 wxString message
 wxString caption
 wxString defaultValue
 long style
 wxPoint pos


and here is wxSingleChoiceDialog:

wxSingleChoiceDialog::new( parent, message, caption, chs, dt =
PL_sv_undef, style = wxCHOICEDLG_STYLE, pos = wxDefaultPosition )
 wxWindow* parent
 wxString message
 wxString caption
 SV* chs
 SV* dt
 long style
 wxPoint pos
   PREINIT:
 wxString* choices;
 SV** data;
 int n, n2;
   CODE:
 n = wxPli_av_2_stringarray( aTHX_ chs, choices );
 if( !SvOK( dt ) )
 {
   RETVAL = new wxPliSingleChoiceDialog( parent, message,
caption, n,
 choices, 0, style, pos );
 }
 else
 {
   n2 = wxPli_av_2_svarray( aTHX_ dt, data );
   if( n != n2 )
   {
 delete[] choices;
 delete[] data;
 choices = 0; data = 0; n = 0;
 croak( supplied arrays of different size );
   }
   RETVAL = new wxPliSingleChoiceDialog( parent, message,
caption, n,
 choices, data, style, pos );
   delete[] data;
 }
 delete[] choices;
   OUTPUT:
 RETVAL

wxSingleChoiceDialog has a whole new .cpp function 
(wxPliSingleChoiceDialog) written within wxPerl.  It also has a 
destructor there.  It is one of only 7 .cpps. It's not clear to me how 
the destructor it is called, but the two functions are implemented very 
differently.

It would be good to understand why they are different and bring them 
into line with each other.

Regards,

Steve.








Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Steve Cookson

Hi Patrick,

On 21-10-2014 17:06, Patrick via RT wrote:

  When I create a wxSingleChoiceDialog, that does show up as a child.  Why is 
the handling of these two different?
Well, the implementation of the wxSingleChoiceDialog is much more 
complicated. You can look in wxPerl::XS. Here isTextEntryBox:


   wxTextEntryDialog::new( parent, message, caption =
   wxGetTextFromUserPromptStr, defaultValue = wxEmptyString, style =
   wxTextEntryDialogStyle, pos = wxDefaultPosition )
wxWindow* parent
wxString message
wxString caption
wxString defaultValue
long style
wxPoint pos


and here is wxSingleChoiceDialog:

   wxSingleChoiceDialog::new( parent, message, caption, chs, dt =
   PL_sv_undef, style = wxCHOICEDLG_STYLE, pos = wxDefaultPosition )
wxWindow* parent
wxString message
wxString caption
SV* chs
SV* dt
long style
wxPoint pos
  PREINIT:
wxString* choices;
SV** data;
int n, n2;
  CODE:
n = wxPli_av_2_stringarray( aTHX_ chs, choices );
if( !SvOK( dt ) )
{
  RETVAL = new wxPliSingleChoiceDialog( parent, message,
   caption, n,
choices, 0, style, pos );
}
else
{
  n2 = wxPli_av_2_svarray( aTHX_ dt, data );
  if( n != n2 )
  {
delete[] choices;
delete[] data;
choices = 0; data = 0; n = 0;
croak( supplied arrays of different size );
  }
  RETVAL = new wxPliSingleChoiceDialog( parent, message,
   caption, n,
choices, data, style, pos );
  delete[] data;
}
delete[] choices;
  OUTPUT:
RETVAL

wxSingleChoiceDialog has a whole new .cpp function 
(wxPliSingleChoiceDialog) written within wxPerl.  It also has a 
destructor there.  It is one of only 7 .cpps. It's not clear to me how 
the destructor it is called, but the two functions are implemented very 
differently.


It would be good to understand why they are different and bring them 
into line with each other.


Regards,

Steve.







Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Patrick via RT
Tue Oct 21 16:16:09 2014: Request 99607 was acted upon.
Transaction: Correspondence added by pwnbusiness2...@centurylink.net
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Thanks for the reply, Steve.  I can see what you are saying.  I have C and some 
slight C++ experience from years ago.  It was just when OOP was starting to 
take off.  I'd be glad to try to get oriented enough that I could make a little 
contribution, but right now I'm a little disoriented in the syntax and protocol 
of the open-source contribution system not to mention the wxperl contribution 
system.  What file is the wxTextEntryDialog code in?  I can see the 
wxSingleChoiceDialog that you are speaking of.

- Original Message -
From: Steve Cookson via RT bug...@rt.cpan.org
To: pwnbusiness2...@centurylink.net
Sent: Tuesday, October 21, 2014 3:43:42 PM
Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

URL: https://rt.cpan.org/Ticket/Display.html?id=99607 

Hi Patrick,

On 21-10-2014 17:06, Patrick via RT wrote:
   When I create a wxSingleChoiceDialog, that does show up as a child.  Why is 
 the handling of these two different?
Well, the implementation of the wxSingleChoiceDialog is much more 
complicated. You can look in wxPerl::XS. Here isTextEntryBox:

wxTextEntryDialog::new( parent, message, caption =
wxGetTextFromUserPromptStr, defaultValue = wxEmptyString, style =
wxTextEntryDialogStyle, pos = wxDefaultPosition )
 wxWindow* parent
 wxString message
 wxString caption
 wxString defaultValue
 long style
 wxPoint pos


and here is wxSingleChoiceDialog:

wxSingleChoiceDialog::new( parent, message, caption, chs, dt =
PL_sv_undef, style = wxCHOICEDLG_STYLE, pos = wxDefaultPosition )
 wxWindow* parent
 wxString message
 wxString caption
 SV* chs
 SV* dt
 long style
 wxPoint pos
   PREINIT:
 wxString* choices;
 SV** data;
 int n, n2;
   CODE:
 n = wxPli_av_2_stringarray( aTHX_ chs, choices );
 if( !SvOK( dt ) )
 {
   RETVAL = new wxPliSingleChoiceDialog( parent, message,
caption, n,
 choices, 0, style, pos );
 }
 else
 {
   n2 = wxPli_av_2_svarray( aTHX_ dt, data );
   if( n != n2 )
   {
 delete[] choices;
 delete[] data;
 choices = 0; data = 0; n = 0;
 croak( supplied arrays of different size );
   }
   RETVAL = new wxPliSingleChoiceDialog( parent, message,
caption, n,
 choices, data, style, pos );
   delete[] data;
 }
 delete[] choices;
   OUTPUT:
 RETVAL

wxSingleChoiceDialog has a whole new .cpp function 
(wxPliSingleChoiceDialog) written within wxPerl.  It also has a 
destructor there.  It is one of only 7 .cpps. It's not clear to me how 
the destructor it is called, but the two functions are implemented very 
differently.

It would be good to understand why they are different and bring them 
into line with each other.

Regards,

Steve.









Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Steve Cookson - gmail

Hi Patrick,

On 21-10-2014 21:16, Patrick via RT wrote:

Thanks for the reply, Steve.  I can see what you are saying.  I have C and some 
slight C++ experience from years ago.  It was just when OOP was starting to 
take off.  I'd be glad to try to get oriented enough that I could make a little 
contribution, but right now I'm a little disoriented in the syntax and protocol 
of the open-source contribution system not to mention the wxperl contribution 
system.
Your not alone in that! wxPerl has been more organised in the past, but 
we've been through a bit of a hiatus this year and we're still trying to 
pull ourselves together.

What file is the wxTextEntryDialog code in?

wxPerl::XS::TextEntryDialog.xs


I can see the wxSingleChoiceDialog that you are speaking of.

wxPerl::XS::SingleChoiceDialog.xs
wxPerl::cpp::SingleChoiceDialog.

But there are many other references to all these files across the 
directories in MANIFEST files, Makefile files and typemap files among 
others.


There are some descriptions about how it all hangs together on the wiki, 
here:


http://wiki.wxperl.nl/Main_Page

especially the first two items:

here:

http://wiki.wxperl.nl/NewClass

and here:

http://wiki.wxperl.nl/Internals_-_Introduction_to_Wx_XS_Wrappers

Good luck.

Regards

Steve


Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Steve Cookson - gmail via RT
Tue Oct 21 16:38:25 2014: Request 99607 was acted upon.
Transaction: Correspondence added by steveco.1...@gmail.com
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Hi Patrick,

On 21-10-2014 21:16, Patrick via RT wrote:
 Thanks for the reply, Steve.  I can see what you are saying.  I have C and 
 some slight C++ experience from years ago.  It was just when OOP was starting 
 to take off.  I'd be glad to try to get oriented enough that I could make a 
 little contribution, but right now I'm a little disoriented in the syntax and 
 protocol of the open-source contribution system not to mention the wxperl 
 contribution system.
Your not alone in that! wxPerl has been more organised in the past, but 
we've been through a bit of a hiatus this year and we're still trying to 
pull ourselves together.
 What file is the wxTextEntryDialog code in?
wxPerl::XS::TextEntryDialog.xs

 I can see the wxSingleChoiceDialog that you are speaking of.
wxPerl::XS::SingleChoiceDialog.xs
wxPerl::cpp::SingleChoiceDialog.

But there are many other references to all these files across the 
directories in MANIFEST files, Makefile files and typemap files among 
others.

There are some descriptions about how it all hangs together on the wiki, 
here:

http://wiki.wxperl.nl/Main_Page

especially the first two items:

here:

http://wiki.wxperl.nl/NewClass

and here:

http://wiki.wxperl.nl/Internals_-_Introduction_to_Wx_XS_Wrappers

Good luck.

Regards

Steve



Re: [rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-21 Thread Patrick via RT
Tue Oct 21 16:54:35 2014: Request 99607 was acted upon.
Transaction: Correspondence added by pwnbusiness2...@centurylink.net
   Queue: Wx
 Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: open
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Thanks.  I'll see what I can digest of it.

- Original Message - 
From: Steve Cookson - gmail via RT bug...@rt.cpan.org
To: pwnbusiness2...@centurylink.net
Sent: Tuesday, October 21, 2014 4:38 PM
Subject: Re: [rt.cpan.org #99607] Issue using wxTextEntryBox


 URL: https://rt.cpan.org/Ticket/Display.html?id=99607 

 Hi Patrick,

 On 21-10-2014 21:16, Patrick via RT wrote:
 Thanks for the reply, Steve.  I can see what you are saying.  I have C 
 and some slight C++ experience from years ago.  It was just when OOP was 
 starting to take off.  I'd be glad to try to get oriented enough that I 
 could make a little contribution, but right now I'm a little disoriented 
 in the syntax and protocol of the open-source contribution system not to 
 mention the wxperl contribution system.
 Your not alone in that! wxPerl has been more organised in the past, but
 we've been through a bit of a hiatus this year and we're still trying to
 pull ourselves together.
 What file is the wxTextEntryDialog code in?
 wxPerl::XS::TextEntryDialog.xs

 I can see the wxSingleChoiceDialog that you are speaking of.
 wxPerl::XS::SingleChoiceDialog.xs
 wxPerl::cpp::SingleChoiceDialog.

 But there are many other references to all these files across the
 directories in MANIFEST files, Makefile files and typemap files among
 others.

 There are some descriptions about how it all hangs together on the wiki,
 here:

 http://wiki.wxperl.nl/Main_Page

 especially the first two items:

 here:

 http://wiki.wxperl.nl/NewClass

 and here:

 http://wiki.wxperl.nl/Internals_-_Introduction_to_Wx_XS_Wrappers

 Good luck.

 Regards

 Steve
 


---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com




[rt.cpan.org #99607] Issue using wxTextEntryBox

2014-10-20 Thread Patrick via RT
Mon Oct 20 19:52:16 2014: Request 99607 was acted upon.
Transaction: Ticket created by pwnbusiness2...@centurylink.net
   Queue: Wx
 Subject: Issue using wxTextEntryBox
   Broken in: (no value)
Severity: (no value)
   Owner: Nobody
  Requestors: pwnbusiness2...@centurylink.net
  Status: new
 Ticket URL: https://rt.cpan.org/Ticket/Display.html?id=99607 


Hello, 

I was attempting to use a wxTextEntryBox object in my application and I ran 
into a little issue. 

I'm using Wx 0.9923 and Strawberry Perl v. 5.16.3 (built for 
MSWin32-x86-multi-thread) under Windows XP 32-bit SP3. It think the WxWidgets 
install is v. 3.0.0. 

The following is the code: 

#!/usr/bin/env perl 

use warnings; 
use strict; 
use Wx qw(:everything); 


package MyFrame; 

use base 'Wx::Frame'; 

sub new { 

my $ref = shift; 
my $self = $ref-SUPER::new( undef, 
1, 
'Parent Window', 
Wx::wxDefaultPosition, 
[500, 500], 
); 
my $panel = Wx::Panel-new( $self, 
2 
); 
my $dialog = Wx::TextEntryDialog-new( $panel, 
'Please Enter Text', 
'Dialog Header', 
, 
Wx::wxOK|Wx::wxCANCEL, 
Wx::wxDefaultPosition 
); 

return $self; 
} 

package MyApp; 

use base 'Wx::App'; 

sub OnInit { 

my $frame = MyFrame-new; 

$frame-Show( 1 ); 

} 

package main; 

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

When I launch this code from the command prompt in a command window and then 
exit the program normally (using the red X in the upper right hand side of 
the window), the window closes, but the program does not terminate. I have to 
use Control+C to get the command prompt to return and I get the message 
Terminating on signal SIGINT(2). If I comment out the call to the new 
method of the TextEntryDialog, the program will exit normally and the command 
prompt will be redisplayed with no error message. 

Thanks for your time. 

Patrick Nighswonger