setting button background color 
Author Message
 setting button background color

Quote:

> I believe someone mentioned in this newsgroup some months ago
> that with VisualAge for Smalltalk Microsoft Windows edition it
> is not possible to set the background color of a push button.
> Is this true?

Correct. This is a "feature" of Windows itself, not something specific
to VisualAge. Note that OS/2 does not have this limitation. Also, you
*can* buy third-party OCX/ActiveX controls that will provide
alternatives to the standard Windows push button widget and that will
allow you to set their background colors.

Quote:
> I have an application with a 10x10 grid of buttons, where clicking
> a button toggles its color from gray to white, and back to gray.
> If changing the background color of a button is not possible,
> my alternative is to use a 10x10 grid of textfields, set them
> to non-editable, and hook the gettingFocus event with a
> custom method that sets the textfield's background color.  That
> works fine, except for the presence of the blinking insertion
> cursor (if someone knows how to get rid of it, please let me know).

Rather than using a text field, I would be inclined to just use a static
text label (AbtLabelView) and then hook the Button Release event of its
primary widget. I should point out that using WBPro for VA would make
the above much simpler. WBPro could be used to build a custom 10x10 part
that could be embedded within your window using the composition editor.

Quote:
> BTW, I wished the button "clicked" event carried an event argument
> with some information about the button, such as the part name.

If you hook the common widget layer events, you can get this info and
more.

Quote:
> Maybe VA Assist is the answer?

While VA Assist is indeed the answer to a great many VA questions, I'm
afraid that it won't offer any specific help in creating the 10x10
matrix you are looking for.

Hmmm, on second thought, it will offer some help on some aspects of the
problem. I assume that you would like to set appropriate attachments for
the 100 widgets in the 10x10 matrix (for example, having them all
grow/shrink proportionally). Without VA Assist, this could take hours
(assuming you took a break every time your hand cramped up <g>). With VA
Assist, you could set all of the attachments in a minute or two (even
less if they all were to use the same attachment style).

Quote:
> In the VisualAge case, I ended up naming the 100 buttons names from
> 'ButtonA0' to 'ButtonJ9', and then hooking their "clicked" event
> to a custom method with

> finalInitialize
>   self allCoordinates do: [:aCoordinate |
>     (self subpartNamed: 'Button' , aCoordinate)
>       abtWhen: #clicked
>       perform: (DirectedMessage
>                  receiver: self
>                  selector: #buttonClickedAt:
>                  arguments: (Array with: aCoordinate)).

> where aCoordinate is a stringvalue such as 'C3', 'E7'.

> If someone knows a better (or worse) approach, any comments or tips
> are GREATLY appreciated.

Since you are hooking up the event handlers via a script, you might as
well use the common widgets layer events and hook the Button Release
event of a static text widget. That way you can set the widget
background colors, hook the "clicked" event and avoid the problems with
using text fields.

BTW, if you decide to go with my AbtLabelView idea, you can use VA
Assist to morph all 100 buttons into static text widgets (or anything
else you like) with a couple of mouse clicks. That's something that the
composition editor can't help you with at all (you would need to
manually destroy and recreate all of the widgets without VA Assist at
your disposal).

Quote:
> one last question:  I noticed that in VA 4.02 right-mouse clicking in
> the textfield in the dialog prompted when clicking Tools.Hierarchy menu
> item doesn't display the usual popup menu with Cut, Copy, Paste (I need
> that Paste!! surely don't want to type in the full name of a long
> class name every time !!).

The standard cut/copy/paste accelerators all work. For paste, just hit
CTRL+V.

Whatever you decide to do, I would encourage you to explore the power
and ease-of-use provided by VA Assist. Just with your specific problem,
I have identified two unique capabilities that would come in handy (and
save you hours of effort). Our tag line for VA Assist is that the
product will "triple your productivity with the VisualAge composition
editor". I think you will find that to be an understatement once you
begin to use it. For more information on VA Assist, visit our VA Assist
home page at:

        http://www.*-*-*.com/

or check out the VA Assist review in Eye-On-Objects magazine at:

        http://www.*-*-*.com/

-Eric Clayberg
President                      
Smalltalk Systems (StS), a division of Instantiations, Inc.



   Web: http://www.*-*-*.com/
        http://www.*-*-*.com/

GO SMALLTALK!



Wed, 18 Jun 1902 08:00:00 GMT  
 setting button background color

Quote:

>I believe someone mentioned in this newsgroup some months ago
>that with VisualAge for Smalltalk Microsoft Windows edition it
>is not possible to set the background color of a push button.
>Is this true?

Yep.  That's native widgets for ya.  The API for push buttons on the Windows
platform does not allow setting the background color.  If you wanted a
button with a background color, you could use a drawn button, which is
available in the Cw/Ew classes somewhere.

HTH,
David



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. setting button background color

2. conflicts between button colors and background color

3. Setting a web hex color as background color for a canvas

4. Toolbar button background color

5. VA 4.0 Push Button Background color

6. Button's background color..

7. Color Button Background

8. Radio buttons on color background

9. TK42 Cascade menu's buttons background color

10. background color of buttons/menu items is black

11. background color on push buttons

12. How to set background color in VisualWorks 2.0

 

 
Powered by phpBB® Forum Software