|
Well, I have tested your control in a simple dialog in WinXP with silver and olive colored themes and seems to work Ok.
So, at least I think it works ok with standard dialogs.
BR
Jaime.
|
|
|
|
|
Problem 1:
m_crHotTrack = ::GetSysColor( COLOR_HOTLIGHT ); //RGB( 0x00, 0x00, 0xFF );
COLOR_HOTLIGHT is defined if WINVER >= 0x0500
What if WINVER < 0x0500 (Win98, ...).
Problem 2:
OCR_NORMAL is available only with # define OEMRESOURCE
I'm using VC6.0
Am I wrong?
Predrag Manojlovic
|
|
|
|
|
> COLOR_HOTLIGHT is defined if WINVER >= 0x0500
> What if WINVER < 0x0500 (Win98, ...).
COLOR_HOTLIGHT is available on 98 and higher and Win2K and higher (read: not 9x or NT 4.0). If you use that value on one of those platforms, it will return 0 .
> OCR_NORMAL is available only with # define OEMRESOURCE
Yes, because OCR_ identifies an OEM resource: OCR == O EM C uR sor.
> Am I wrong?
See above!
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|
I cann't complie the source, why?
=============================================
SkinMagic SDK Library
The better solution for Skinnable application
http://www.appspeed.com
==============================================
|
|
|
|
|
Because you're spending too much time spamming the message boards?
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
|
> I cann't complie the source, why?
Perhaps some example error messages...?
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|
Hi James,
Nice article. I noticed it because i wrote my own hyperlinks just couple weeks ago. I thought it might be useful to anyone reading this article as well as for both of us to help each other improve our libraries. You can download my hyperlinks here www.tooltips.net. To start with,
For example, many of them are based on the Static control, and as such are unable to be focused using the keyboard, which means that they are useless without a mouse (accessibility issue), and have incorrect click behavior.
isn't correct, and CStatic can be overridden to accept keyboard input.
For a difference, i wrote my hyperlink to support different styles and behavior. One of them: when you hover the mouse cursor over the object it gets underlined. Anyway, you also got something i didn't extend my hyperlink with, like drag'n drop support. But hey, very good, nice article, as i said. I hope to hear from you also as regards to my hyperlinks, to compare with the lots of others you mentioned out there in the internet space.
One big problem with your hyperlink i noticed at first glance was that it flicks and updates itself too much when the mouse is moving above it.
I hope i didn't get you offended sticking into your article like this or anything...
Cheers!
Vitaly
Ultimate all-in-one XP-Style UI multiplatform solution: Tooltips, XP Menus, Hyperlinks, Drawing Graphics and formatted documents, plus powerful binary resource reuse. All Free 100%, visit www.tooltips.net now. The most powerful integrate UI library for developers in VC++, C#, Java, VB, Delphi, Borland C++, Borland C++ Builder, as well as any COM-compatible platform; Unified approach, cross-language OS, full .NET integration.
|
|
|
|
|
> To start with:For example, many of them are based on the Static control, and as such are unable to be focused using the keyboard, which means that they are useless without a mouse (accessibility issue), and have incorrect click behavior. > isn't correct, and CStatic can be overridden to accept keyboard input.
A control usually only accepts keyboard input only when it has the input focus. Of course, the Parent window can also handle keyboard input on behalf of the control. But keyboard input is not the problem, the focus is.
However, giving the benefit of the doubt, I downloaded your HyperLinks example program, and the hyperlinks demonstrated in it suffer from some of the problems that I mention in my article: 1: they cannot be focused via the keyboard (the <TAB> key does nothing, the focus remains on the Exit button) and the focus does not change to the control via the mouse; and 2: the links activate on the button-down, not the button-up.
Also, the controls show tooltips even when their parent window does not have the focus (for example, move the browser window so that it overlaps half of the demo application's window; click in the browser to make it the active window, and then mouse-over the controls in the demo). The tooltips are not supposed to be shown. Lastly, your CheckBox and HighLight buttons also activate on the button-down, not the button-up. You can observe the correct behavior by pressing the mouse button down on the Exit and not releasing it, and noting that the application is still running!
The controls also do not appear to capture the mouse correctly (but that may be a moot point because the controls react to the button-down).
However, I do like your tooltips, even if they do take a little while to come and go!
If I may offer a thought: The controls/style that you call "Web-Like Hyperlinks" in your demo application behave more like flyover or "hot" buttons. Most hyperlinks in browsers do not modify their appearance that much when they are moused-over, at least not without the help from JavaScript or DHTML...!
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|
About all the problems you described i only can say that the hyperlings i designed are very customizable. You can override them easily to make work the way you want. It got lots of virtual functions for that.
If you're saying that you do not want to see tooltips for inactive applications, just handle WM_ACTIVATE in your application, and switch off the tooltips, if the window is deactivated by calling m_tt.Active = false;
To enable keyboard focus and input set flag WS_TABSTOP visually in the resource designer, then you can draw different QHTML appearance of hyperlinks depending whether or not the control has the input focus. If you don't like it handling WM_LBUTTONDOWN, ok, then just override the windows event, and call OpenUrl when you need it. Again, class CHyperLink can be customized any way you want. And it has very straightforward code in it.
The way i called those Web-Like Hyperlinks isn't so important, but yes, you would need to use JavaScript to simulate it. I always do so, for instance even on my web site, if you noticed that.
The controls also do not appear to capture the mouse correctly
-Why? What do you mean?
Ultimate all-in-one XP-Style UI multiplatform solution: Tooltips, XP Menus, Hyperlinks, Drawing Graphics and formatted documents, plus powerful binary resource reuse. All Free 100%, visit www.tooltips.net now. The most powerful integrate UI library for developers in VC++, C#, Java, VB, Delphi, Borland C++, Borland C++ Builder, as well as any COM-compatible platform; Unified approach, cross-language OS, full .NET integration.
|
|
|
|
|
> About all the problems you described i only can say that the hyperlings i designed are very customizable. You can override them easily to make work the way you want. It got lots of virtual functions for that.
I never said that the problems could not be "worked around". My goal as a software developer is to design/develop things that do not need to be "worked around" in order to function as expected. Some have other goals...
> If you're saying that you do not want to see tooltips for inactive applications, just handle WM_ACTIVATE in your application, and switch off the tooltips, if the window is deactivated by calling m_tt.Active = false;
I am saying that the expected behavior of tooltips is not to be shown if their control/parent is not active. Try this in Explorer and you will see what I mean. My control behaves as expected, without the need to handle WM_ACTIVATE at the application level, and propogate that notification throughout all visible controls. That sounds like a lot of work just to get something to work correctly, when it could have been done at the control level.
> To enable keyboard focus and input set flag WS_TABSTOP visually in the resource designer, then you can draw different QHTML appearance of hyperlinks depending whether or not the control has the input focus.
Actually, you would just draw a normal Focus Rectangle, and while adding the style makes the control navigable via the keyboard, it still cannot be activated without "working around" with some additional code.
> If you don't like it handling WM_LBUTTONDOWN, ok, then just override the windows event, and call OpenUrl when you need it. Again, class CHyperLink can be customized any way you want. And it has very straightforward code in it.
As I said before, I did not say that the issues could not be "worked around", I believe they should not be there in the first place... But we are of different schools of thought, it seems. Oh, well.
>> The controls also do not appear to capture the mouse correctly
> -Why? What do you mean?
I cannot make the point any clearer. Do you not understand what it means to "capture" the mouse? Besides, since the controls activate on the button-down, it is a moot point: this is something else that can be "worked around" if needed.
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|
Just use QHTM - http://www.gipsysoft.com/
|
|
|
|
|
Very original, Russ
Very
Ultimate all-in-one XP-Style UI multiplatform solution: Tooltips, XP Menus, Hyperlinks, Drawing Graphics and formatted documents, plus powerful binary resource reuse. All Free 100%, visit www.tooltips.net now. The most powerful integrate UI library for developers in VC++, C#, Java, VB, Delphi, Borland C++, Borland C++ Builder, as well as any COM-compatible platform; Unified approach, cross-language OS, full .NET integration.
|
|
|
|
|
The point is taken,
but again, what's wrong in my code with capturing mouse?
Ultimate all-in-one XP-Style UI multiplatform solution: Tooltips, XP Menus, Hyperlinks, Drawing Graphics and formatted documents, plus powerful binary resource reuse. All Free 100%, visit www.tooltips.net now. The most powerful integrate UI library for developers in VC++, C#, Java, VB, Delphi, Borland C++, Borland C++ Builder, as well as any COM-compatible platform; Unified approach, cross-language OS, full .NET integration.
|
|
|
|
|
> but again, what's wrong in my code with capturing mouse?
As I research it further, the controls seem to capture the mouse correctly, but do not behave correctly when the mouse is captured.
Try this: button-down on a standard button (your About Box is a good place to test this), while keeping the mouse button down, move the cursor over one of your link controls. Your control will still show its tooltip and will hot-track. It is not supposed to (using the behavior of similar controls as a guide).
[As I take my dead horse out and start beating on it] BTW: a small side effect of not activating on the button-up instead of the button-down is that you remove the user's chance to "change their minds" by moving the mouse off of the control before releasing the mouse button (standard buttons work like that). (For controls that have drag behavior, drag operations are normally canceled by pressing <ESC> or pressing the opposite mouse button that was used to start the drag.)
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|
Thanx a lot James, I appreciate all your comments. You definitely had more fun with hyperlinks than I did. I'm going to make all the modifications you suggested me.
And I rate your article *****, - also for patience with your competitors. Peace!
Regards,
Vitaly
Ultimate all-in-one XP-Style UI multiplatform solution: Tooltips, XP Menus, Hyperlinks, Drawing Graphics and formatted documents, plus powerful binary resource reuse. All Free 100%, visit www.tooltips.net now. The most powerful integrate UI library for developers in VC++, C#, Java, VB, Delphi, Borland C++, Borland C++ Builder, as well as any COM-compatible platform; Unified approach, cross-language OS, full .NET integration.
|
|
|
|
|
> Thanx a lot James, I appreciate all your comments [...]
Well, you took the comments much better than most others that I have encountered on here, so kudos to you, too!
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|
No time wasting right,
I've just finished implementing all of those items you noticed:
- Activate on mouse up, and on button up
- Use tab to switch between items
- Draw focus rectangle
- Items with focus respond to VK_RETURN on key down and VK_SPACE on key up - something you forgot
- Extra: drawing disabled hyperlinks using grayed text color, plus brightened color - you don't have it
- Tooltips are not displayed when the window is not active
Everything has been updated on my website www.tooltips.net for downloading.
Thanx again.
Cheers!
Ultimate all-in-one XP-Style UI multiplatform solution: Tooltips, XP Menus, Hyperlinks, Drawing Graphics and formatted documents, plus powerful binary resource reuse. All Free 100%, visit www.tooltips.net now. The most powerful integrate UI library for developers in VC++, C#, Java, VB, Delphi, Borland C++, Borland C++ Builder, as well as any COM-compatible platform; Unified approach, cross-language OS, full .NET integration.
|
|
|
|
|
> Activate on mouse up, and on button up
Does this mean, "Activate on button-up, if the mouse is over the control's client area?"
> Items with focus respond to VK_RETURN on key down and VK_SPACE on key up - something you forgot
I left out activation on VK_SPACE because using the space bar in Internet Explorer serves to "page" the document up or down, like using the old MORE utility, and I was trying to use IE's link behavior as a guide (even though normal buttons activate on it).
There was a reason I left out activation on VK_RETURN , even though both buttons and links work like that, but I cannot remember what it was now... Hmmm...
> Extra: drawing disabled hyperlinks using grayed text color, plus brightened color - you don't have it
Nice feature. I do not have any additional fluff or features because I was aiming for a IE-like link control. (But now it is bugging me that I cannot remember why I did not handle VK_RETURN ...!)
Great work!
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|
Does this mean, "Activate on button-up, if the mouse is over the control's client area?" - yes, it certainly does.
I understand something about keyboard handling can be questionable.
Now, if it is interesting to you or somebody else, i was trying to use function DrawFocusRect like you did:
if( GetFocus() == this ) // If We Are Focused
{
dcDC.DrawFocusRect( &m_rLinkArea ); // Draw The Focus Rectangle
}
But it seemed pretty messy with its XOR drawing method, i had too many problems, dunno why. Finally, getting sick of it i decided just to draw the focus rectangle on my own. Here's what i came up with:
// This method is called when the objects needs
// to draw the focus rectangle.
// Override this method to draw your own focus rectangle.
void CHyperLink::OnDrawFocus(CDC & dc, RECT & r)
{
LOGBRUSH info;
info.lbStyle = BS_SOLID;
info.lbColor = ::GetSysColor(COLOR_WINDOWFRAME);
HPEN hPen = ::ExtCreatePen(PS_GEOMETRIC|PS_DOT, 1, &info, 0, NULL);
HGDIOBJ hOldObj = ::SelectObject(dc, hPen);
::MoveToEx(dc, r.left, r.top, NULL);
::LineTo(dc, r.right, r.top);
::LineTo(dc, r.right, r.bottom);
::LineTo(dc, r.left, r.bottom);
::LineTo(dc, r.left, r.top);
::SelectObject(dc, hOldObj);
::DeleteObject(hPen);
}
, which draws exactly what looks like the standard focus rectangle, or even better, without distorting colors sometimes - you could notice that in your example. And as long i made it a virtual function anyone can just override it to draw their own focus rectangle, ain't this neat?
Thanx a lot for your contribution;)
You did Great Work too;)
Peace!
Ultimate all-in-one XP-Style UI multiplatform solution: Tooltips, XP Menus, Hyperlinks, Drawing Graphics and formatted documents, plus powerful binary resource reuse. All Free 100%, visit www.tooltips.net now. The most powerful integrate UI library for developers in VC++, C#, Java, VB, Delphi, Borland C++, Borland C++ Builder, as well as any COM-compatible platform; Unified approach, cross-language OS, full .NET integration.
|
|
|
|
|
Hey,
Just wondering what part of Ireland your based in. The picture on the site is Dublin anyway. You based there?
Regards,
Brian Dela
Run naked in the snow until you're sweating like a stuck pig and can't seem to catch your breath. When the flu becomes pneumonia, they can cure that with a shot. - Roger Wright
|
|
|
|
|
yep, i'm in Dublin
Ultimate all-in-one XP-Style UI multiplatform solution: Tooltips, XP Menus, Hyperlinks, Drawing Graphics and formatted documents, plus powerful binary resource reuse. All Free 100%, visit www.tooltips.net now. The most powerful integrate UI library for developers in VC++, C#, Java, VB, Delphi, Borland C++, Borland C++ Builder, as well as any COM-compatible platform; Unified approach, cross-language OS, full .NET integration.
|
|
|
|
|
press "deny link activation" then double-click on the link (don't let go of mouse button on second click)
you'll see the standard windows button (not owner-drawn)
good link control other than that
- Roman -
|
|
|
|
|
Thank you for the find.
This is fixed in the update, as well as Right-click and Right-Mouse-Button-Drag support. The fix for that particular problem is to have the control "eat" the WM_LBUTTONDBLCLK message.
The update will be submitted before this Wednesday.
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|
The update has been submitted (Version 1.1), may take a while to appear...
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|