Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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?

Replies are listed 'Best First'.
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.


      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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://370447]
Approved by rupesh
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2018-06-22 10:26 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.