Re: [perl-win32-gui-users] Wrappers for listviews/comboboxes etc...

2005-02-15 Thread jez
Quoting Ariel Serbin <[EMAIL PROTECTED]>:

> I decided that it was time to whip up some
> wrapper
> modules that do all of this for me.  It seems to
> me
> like it would be a pretty handy thing to have
> around,
> so here are a few questions for the group:
> 
> Have any of you done this sort of thing
> before?
> If so, can I have a look?
> Does this make any sense?
> Any helpful suggestions?
Yes it does make sense and it is a good idea.

I must admit I'm a bit of a combo box and list view 
junky and I've often thought that a few extra methods 
for these objects would make programming much simpler 
(and more perl like, rather than "coping" with the 
windows API). Up until a few days ago I didn't know 
you could use the Text method to get the selected text 
in a combo box – previously I was using GetString with 
SelectedItem!

I think the first step would be to give more 
information on the kind of thing you want to create. 
I'm sure several people on the list can contribute 
some ideas. If you end up with a set of methods, then 
they could be added directly Win32::GUI, or 
alternatively it could be a ‘helper’ package that 
would be installed separately.

Hope that helps,

cheers,

jez. 




Re: [perl-win32-gui-users] Wrappers for listviews/comboboxes etc...

2005-02-15 Thread Johan Lindstrom

At 23:59 2005-02-14, Ariel Serbin wrote:

I decided that it was time to whip up some wrapper
modules that do all of this for me.  It seems to me
like it would be a pretty handy thing to have around,


I say: go for it! If you can generalize your problem to a module, other 
people will probably find it useful. This list can probably provide useful 
comments regarding name spaces etc.




Have any of you done this sort of thing before?
If so, can I have a look?
Does this make any sense?
Any helpful suggestions?


Are there any drawbacks GUI-wise to having a hidden column? I.e. does it 
screw up tab-order or somesuch? If it does, it may be better to use a 
shadow array to keep the extra data.



/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




Re: [perl-win32-gui-users] Wrappers for listviews/comboboxes etc...

2005-02-15 Thread Ariel Serbin
Thanks for the responses...

That's good to know about Text() on the comboboxes.
I've been doing it the other way, as well.  

I'm not sure if there's any weirdness related to
having the 0-width column because I always do
fullrowselect.  I've thought about the shadow array
idea before and it is probably the best way to go. 
One of the benefits to having the hidden field is that
I can expand it when debugging my code, but that
doesn't seem to be a good reason to design the wrapper
in that manner.  Now that I think about it, the array
would probably be best for consistency, since there's
nowhere to hide a key field in the comboboxes.

I'm not exactly sure how I would like to implement
this either.  It would be cool to be able to do
something like:

# get some data
$sth = $dbh->prepare('select person_id, first_name,
last_name from people');

...

# call a method to assign ids and populate the LV.
# if called without a key field it could
# automagically assign ids

$lv_wrapper->populate($sth->fetchall_hashref,
'person_id');

# suppose we have a button to remove items
# from the LV

btnRemove_Click {
 $id = $lv_wrapper->id();
 $lv_wrapper->remove($id);
 return 1;
}

The neat thing about the hashref idea is that columns
could be named just by setting the AS params in the
sql and everything would be taken care of.  This is a
decent model for when I'm building gui elements from a
DB, but it doesn't really match up to situations where
I build elements from an array of objects.

Any opinions?

-Ariel





Re: [win32gui] Re: [perl-win32-gui-users] Wrappers for listviews/comboboxes etc...

2005-02-15 Thread Robert May

Hi all,

I've been a lurker on this list for some time now (probably a year or 
more), but I finally got time in the last few weeks to start playing 
with Win32::GUI properly.  Firstly can I thank the regulars for a great 
set of features, and to say what an improvement V1.0 is over what I had 
played with before.


I have been thinking about this wrapper idea for some time, as there are 
a number of useful 'widgets' that I would keep reusing, and think they 
could be packaged up for others to use.  Initially I was thinking of GUI 
framework items:  examples are splash screens, about boxes and the like, 
that virtually every UI wants in order to look professional, but is the 
almost the same over and over again.  If nothing else these could serve 
as great examples of what can be done.


Whilst I don't have anything to contribute in this vein right now, I 
though this might be a good moment to introduce HyperLink.pm - a 
sub-classing of Win32::GUI::Label that acts as a clickable hyperlink:


Headline features are:
- change of cursor to 'hand' when hovering over the label
- by default text is blue rather than black
- by default text gets underlined when the mouse is hovering
- by default link gets launched in browser when clicked
- takes all options available to Win32::GUI::Label class
- all defaults can be turned off or otherwise controlled

There is more documentation in the file itself, and a demo script 
available at http://www.robmay.me.uk/win32gui/


Is this sort of packaging appropriate for others to use?  I'd appreciate 
feedback on whether more 'widgets' like this might be useful.


Regards,
Rob.


Ariel Serbin wrote:


Thanks for the responses...

That's good to know about Text() on the comboboxes.
I've been doing it the other way, as well.  


I'm not sure if there's any weirdness related to
having the 0-width column because I always do
fullrowselect.  I've thought about the shadow array
idea before and it is probably the best way to go. 
One of the benefits to having the hidden field is that

I can expand it when debugging my code, but that
doesn't seem to be a good reason to design the wrapper
in that manner.  Now that I think about it, the array
would probably be best for consistency, since there's
nowhere to hide a key field in the comboboxes.

I'm not exactly sure how I would like to implement
this either.  It would be cool to be able to do
something like:

# get some data
$sth = $dbh->prepare('select person_id, first_name,
last_name from people');

...

# call a method to assign ids and populate the LV.
# if called without a key field it could
# automagically assign ids

$lv_wrapper->populate($sth->fetchall_hashref,
'person_id');

# suppose we have a button to remove items
# from the LV

btnRemove_Click {
$id = $lv_wrapper->id();
$lv_wrapper->remove($id);
return 1;
}

The neat thing about the hashref idea is that columns
could be named just by setting the AS params in the
sql and everything would be taken care of.  This is a
decent model for when I'm building gui elements from a
DB, but it doesn't really match up to situations where
I build elements from an array of objects.

Any opinions?

-Ariel




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


 





[perl-win32-gui-users] Win32::GUI bugs

2005-02-15 Thread Robert May

A quick question on process:

Should potential bugs be discussed on this list before raising bug 
reports at sourceforge?


Rob.



[perl-win32-gui-users] Radio Buttons Question - Win32::Gui

2005-02-15 Thread Daniel Mazzini
Hi all
 
I have two questions:
 
1. I am trying "to check" a radio button as initial state, I mean when I open a 
window. I used the option -checked=>1,  but nothing happens.
 
2. I want to get the the radio_button selected.
 
I have been programming with perl for the last two years, I used Tk in the 
past, but I want to learn about WIN32::Gui. 
 
Thanks.
 
Here my code:
 
#!/opt/nokianms/bin/perl
# #
# Complex Upgrade Script
# Purpose: Generate XML Files for zcomplex Upgrades
# Daniel Mazzini - Nokia USA
# AWS/CINGULAR Project
# Last Update: Feb 15, 2005  
# Version 1.0
# #
# #
# Modules and declaration
# #
use Win32::GUI;

$w_main_cu= new Win32::GUI::DialogBox(
-name=> "w_main_cu",
-text=> "MY MAIN WINDOW",
-size=> [300,200],
-helpbutton  => 0,
-menu=> 0,
-maximizebox => 0,
-minimizebox => 1,
-resizable   => 0,
  );
$w_main_cu->Show();  
$w_main_cu->AddButton(
   -text=> "OPTIONS",
   -name=> "gb_options",
   -left=> 33,
   -top => 22,
   -width   => 198,
   -height  => 67,
   -style  => WS_CHILD | WS_VISIBLE | 7,  # GroupBox
  );

$w_main_cu->AddRadioButton(
   -text=> "OPT 1",
   -name=> "Rb_option1",   
   -left=> 59,
   -top => 50,
   -width   => 60,
   -height  => 12,
  );
$w_main_cu->AddRadioButton(
   -text=> "OPT 2",
   -name=> "Rb_option2",
   -left=> 150,
   -top => 52,
   -width   => 60,
   -height  => 12,
   );  
   
$w_main_cu->AddButton(
   -text=> "Execute",
   -name=> "cb_cu",
   -left=> 150,
   -top => 130,
   -width   => 100,
   -height  => 25,
   -foreground=> 1678,
   -addstyle => BS_DEFPUSHBUTTON
  );

Win32::GUI::Dialog();
 
sub cb_cu_Click{  
#I want to get here what option was selected.  (Selected RadioButton)  
}
 
sub w_main_cu_Terminate {
$w_main_cu->Disable();
$w_main_cu->Hide();
return -1;
}

 
 
 



 

Daniel Mazzini 

Desk +1 972-374-0081 / Mobile +1 2142088109
Email : [EMAIL PROTECTED]/[EMAIL PROTECTED]