That annoying little focus rectangle...

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

That annoying little focus rectangle...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:22 pm

by Craig Shearer >> Tue, 7 Mar 2000 0:11:25 GMT

Hello all

I'm designing a custom control and I'd like to have a button on it that causes something to happen.

It seems that the best candidate control to use is the Button control as it has all of the functionality that I need.

The only problem is that when I use a standard JADE button, and click on the button, I get the ugly focus rectangle drawn on the button. Is there anyway of making a JADE button not have this rectangle, or is setting the focus away to some other control on a gotFocus event the only way around it?

Craig.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: That annoying little focus rectangle...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:22 pm

by Darrell Duniam >> Tue, 7 Mar 2000 1:51:28 GMT

Wouldn't changing the "tabStop" property to false achieve what you want, rather than mucking about setting the focus to another control ?

I believe that in JADE 5.1, the JadeJuiceControl is renamed (and exposed), and also defaults to the behaviour of a standard button (not sure whether that includes the focus rectangle).

darrell.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: That annoying little focus rectangle...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:22 pm

by Craig Shearer >> Tue, 7 Mar 2000 19:07:53 GMT

Nope, that simply stops the control from being in the tab sequence. The control can still get focus, and when it does, it has the dashed rectangle drawn over my picture, and the heavy black outline around the button.

My motivation for doing this is simple. I'm wanting to have a button in my application that supports the standard Windows colours (ie, if the user changes their appearance settings, then the colour of my buttons will also change) and still has all the button functionality. This is remarkably difficult to achieve in JADE, without having this ugly focus rectangle.

I've seen other JADE applications that completely ignore the Windows colour settings - because all the buttons are simply pictures with an up and down state. The problem with this approach is that you're stuck with the colours designed-in to the application.

Craig.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: That annoying little focus rectangle...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:23 pm

by Dean Cooper >> Wed, 8 Mar 2000 1:29:48 GMT

As well as a specific colour, the backColor and foreColor properties of Button (and other controls) allow you to specify things like 3D Face, 3D Highlight, Active Border, etc, etc which tell Jade to use the appropriate colour from the user's appearance settings. Is this not what you want Craig, or am I missing something?

Doesn't address your issue with the focus rectangle though...

Dean.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: That annoying little focus rectangle...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:23 pm

by Craig Shearer >> Wed, 8 Mar 2000 8:43:10 GMT

Dean,

That's exactly what I'm saying. I want a button that I can put an image on that works exactly like a button and supports the standard Windows colour schemes. The standard JADE button does just this but has the ugly focus rectangle, which is what I'm trying to work around.

Other options are:

1. Use a frame control, but the borders on a frame control a different from a button control, otherwise it's not a bad option.

2. Use a picture control and use images for the up and down states, but then you're stuck with the colours designed into the image and therefore the button won't obey the Windows colour scheme settings that the user has chosen.

A seemingly ideal alternative would be the ToolbarPicture control supplied in the RootSchema (and hidden from view, for some reason). However, this control has the undesirable effect of only looking like a button when you pass the mouse over it (although, this is a trendy effect to have on a toolbar!). Since JADE doesn't allow you to subclass this control, there doesn't seem to be any way to modify its behaviour.

Ideas?

Craig.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: That annoying little focus rectangle...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:23 pm

by Geoff McIlraith >> Mon, 13 Mar 2000 4:06:44 GMT

Craig,

If you only have one system colour you want to use in your pictures, I have a grubby technique for you...

Use picture controls for your buttons, and manufacture your pictures with the system colour replaced.

To do this, you create your pictures as you would if you wanted them to be transparent.
Now all you have to do is replace the transparent area with the system colour....How? Here's how...(I think)

1. Create a frame off-screen with no borders and with the background colour set to the appropriate system colour.
2. Create a child picture control in the frame.
3. Set your transparent picture into it, and set the transparent colour property.
4. Use the createPicture() routine to create a new picture with the system colour background of the frame showing through the transparent bits. 5. Use the result in your toolbar button class.

eg:

// The following properties are set up in the painter ...
// frame.left = 0;
// frame.top = -1000; // to ensure off-screen.
// frame.backColor = systemColor;
// picture.parent = frame;
// picture.borderStyle = 0;
// picture.transparent = true;
// picture.transparentColor = White;
// picture.color = true;

picture.picture := myTransparentToolBarPiccie;
myToolbarPic := frame.createPicture(false,true,24);

....

This can also be used a technique for speeding up rendering of transparent pictures - so long as you know that the background color won't change.

Cheers, Geoff.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: That annoying little focus rectangle...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:23 pm

by Robert Barr >> Wed, 8 Mar 2000 3:21:04 GMT
My motivation for doing this is simple. I'm wanting to have a button in my application that supports the standard Windows colours (ie, if the user changes their appearance settings, then the colour of my buttons will also change) and still has all the button functionality. This is remarkably difficult to achieve in JADE, without having this ugly focus rectangle.
If you remove the rectangle, then you risk confusing users who have become used to this standard windoze behaviour. If your application supports keyboard (as opposed to/as well as mouse) users, how else can you indicate button focus so the user knows what they are selecting when they press <enter>?

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: That annoying little focus rectangle...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:23 pm

by David Mitchell >> Wed, 8 Mar 2000 7:28:14 GMT
My motivation for doing this is simple. I'm wanting to have a button in my application that supports the standard Windows colours (ie, if the user changes their appearance settings, then the colour of my buttons will also change) and still has all the button functionality. This is remarkably difficult to achieve in JADE, without having this ugly focus rectangle.
If you remove the rectangle, then you risk confusing users who have become used to this standard windoze behaviour. If your application supports keyboard (as opposed to/as well as mouse) users, how else can you indicate button focus so the user knows what they are selecting when they press <enter>?

Maybe they have another way of showing what has the focus, which better suits the style of their interface, and thus you would want to get rid of the windows rectangle.

--
David Mitchell
JADE Kid - 1998
www.jadekids.com

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: That annoying little focus rectangle...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:23 pm

by Craig Shearer >> Wed, 8 Mar 2000 8:38:39 GMT

Of course, you're correct Robert, but what I'm trying to achieve is something approaching a toolbar button. You don't see toolbar buttons with focus rectangles painted on them do you?

Buttons are most conveniently clicked with a mouse, and I'd like to cater for keyboard users with a different mechanise, say a menu option.

Craig.


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 31 guests