[plt-scheme] editor-canvas% and popup-menu%

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Apr 17 08:24:42 EDT 2006

At Thu, 13 Apr 2006 11:25:24 +0200 (CEST), Ivanyi Peter wrote:
> 1.
> editor-canvas%
> For this widget in the style I can specify 'combo', and it
> draws out the 
> arrow at the end of the widget. However I cannot find anyway
> to use
> this feature. I cannot find out that the user has clicked on
> the arrow 
> as there is no callback for it. I cannot determine that the
> mouse is in
> the area of the arrow and the user clicked as the size of
> the arrow
> is a private constant for MrEd.

I will add a canvas<%> method to test whether a (click) location is on
the arrow.

Meanwhile, a good approximation is that if the click event's X value is
larger than the client size of the editor-canvas%, then it's a click on
the arrow.

> 2. popup-menu%
> Below you can find a little code, which I think, was
> published in this
> list. My problem is with the set-min-width method for the
> popup-menu%
> widget. It simply does not work. No matter what value I
> specify it only
> creates widgets with the size of the text.

Can you remind me of the platform? (I've only tried on Mac OS X, so
far, where it works ok.)

> 3.
> This is a bit related to the popup-menu. How can I create a
> menu item
> which has a non-default color as a background?

There's no way to do this. You can create an image that is a colored
shape with text on it, and then use the image for the button's label.
But directly setting the background color for a button is not supported
by all of the underlying GUI toolboxes, and it's strongly discouraged
by GUI design guidelines.


Posted on the users mailing list.