Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Win32::GUI frustration

by flippy (Novice)
on Jun 29, 2004 at 11:48 UTC ( #370447=perlquestion: print w/ replies, xml ) Need Help??
flippy has asked for the wisdom of the Perl Monks concerning the following question:

Hi, This is my first question posted here - apologies if I've missed anything obvious...

I've just started using Win32::GUI in order to simplify user interaction with my programme.

To seamlessly integrate my code with that of other applications, I'd like to assign a colour to my main window's background. Either I'm having an off day, or it's non-trivial. Can anyone help?

Comment on Win32::GUI frustration
Re: Win32::GUI frustration
by jplindstrom (Monsignor) on Jun 29, 2004 at 12:20 UTC
    It's actually non-trivial :) You need to define your own "class" (not an OO class) and assign the color to it, then assign the "class" to your window. This is roughly how to do it:

    my $clsColor = Win32::GUI::Class->new( -name => "classColor", -color => 2, ) or die("Could not create Class\n");

    And when you create the window, add the option

    -class => $clsColor,

    If you happen to use The GUI Loft, I stole this snippet from the demo program FetchURL. It's a bit different, so copy the demo program and go from there.

    /J

      That's ace - thanks!

      Although if you can tell me how '2' is 'pale blue', that'd be ace, too..

      I tried the following, as I need a specific colour, having read the faq, to no avail.. 'Could not create class'

      #Brush to define the colour my $brush = new Win32::GUI::Brush(-color=>[198, 223, 198])or die("Coul +d not create Brush\n"); #Class for the colour my $clsColour = Win32::GUI::Class->new( -name => "classColour", -color => $brush, ) or die("Could not create Class +\n");
      Above was me -- sorry, forgot to log in!
Re: Win32::GUI frustration
by gellyfish (Monsignor) on Jun 29, 2004 at 12:22 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://370447]
Approved by rupesh
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2014-10-21 09:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (99 votes), past polls