Re: [perl-win32-gui-users] Documentation and default values [Was: BUG Followup[1092732 ]:Slider no longer supports setting position]

2005-03-24 Thread Jez White
The XS code cannot provide a default in this case (due to the 
optionality of the first argument), and so explicitly looks at the 
number of arguements.   We have 4 ways to call this method, and for 
consistency with what happens elsewhere this is how  I believe the 
behaviour should be:
(1) $obj->Pos()  - 0 arguments, return current position 
(TBM_GETPOS)
(2) $obj->Pos($pos)  - 1 argument,  redraw defaults to 1 and 
redraw is requested
(3) $obj->Pos($pos, 1)  - 2 arguments, redraw explicitly set to 1, 
redraw is requested
(4) $obj->Pos($pos, 0)  - 2 arguments, redraw explicitly set to 0, 
redraw is not requested


The "bug" I reported is with option (2), where the current code defaults 
redraw to 0.  For consistency I think this should be changed.  Can we 
reach an agreement on this?


Sounds good to me.

Cheers,

jez.



Re: [perl-win32-gui-users] Patches for toolbar.xs and Hook()ing WM_NOTIFY

2005-03-24 Thread Jez White


I have been struggling with getting drop-down menus from toolbar buttons 
working.  I'm nearly there, but not quite.  I'll post separately to 
share my finding once I have some tidier working code.   I've found a 
number of problems that need fixing in the XS source (some related to 
drop-down menus, others that I have stumbled across while researching 
toolbars in general).  Here's a quick summary with patches below (I've 
compiled and checked these changes, but don't have CVS write at 
sourceforge, so would appreciate it if someone else could validate them 
and check them in).


I can do this - I'll coordinate with Robert offlist.

Cheers,

jez.



[perl-win32-gui-users] Passing events through to a module

2005-03-24 Thread Gareth John
I would like to implement a Win32::GUI frontend as a module 
(class/object), e.g.:


--
#!/usr/bin/perl -w
use MyGUI;

my $gui = MyGUI->new();
$gui->dialog();

--

where the dialog method maps to Win32::GUI::Dialog().

Is there any way to automatically pass all Events (e.g. _Click events, 
etc) through to the GUI object from the main perl script, or do I need 
to forget about implementing the GUI as a class/object and do it all in 
the main perl script?


Thanks,
Gareth



Re: [perl-win32-gui-users] Passing events through to a module

2005-03-24 Thread Johan Lindstrom

At 01:35 2005-03-25, Gareth John wrote:
Is there any way to automatically pass all Events (e.g. _Click events, 
etc) through to the GUI object from the main perl script, or do I need to 
forget about implementing the GUI as a class/object and do it all in the 
main perl script?


That sounds a lot like how I thought when I started with Win32::GUI. But 
the programming model for Win32::GUI doesn't work quite like that.


Event handlers are either subs that follow the naming convention (i.e 
controlName_EventName), or if you are using the New Event Model (NEM) they 
are coderefs.


Note that you can fake method calls with closures, something like this:

my $self = MyGUI->new();
my $win = ... create window...
$win->AddButton (
-name => "Test",
-text => "Test",
-events   => {
Click => sub {
#$self and $win are available here
...
},
},
);


It's not entirely pretty, but it may work for you.


/J

 --  --- -- --  --  - - --  -
Johan LindströmSourcerer @ Boss Casinos   johanl AT DarSerMan.com

Latest bookmark: "TCP Connection Passing"
http://tcpcp.sourceforge.net/
dmoz: /Computers/Programming/Languages/JavaScript/ 12