May 01, 2024, 04:24:23 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Mouse over custom button

Started by Andy, October 19, 2015, 05:42:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Hi,

I know something like this has been asked several times before but....

I'm using Larry's Custom Button Library / Designer in my programs.

In this add-on, you can set the custom button to change say It's border colour when the user places the mouse over it.

That's great, but wondered if I could take it a step further and make the button appear "different" when mouse over occurs.

I.e. change it's shape, or make it look 3D etc or make it stand out in some way.

Can this be done? guess this is one for Larry.

Thanks,
Andy.
:)

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Quote from: andy1966 on October 19, 2015, 05:42:38 AM
....you can set the custom button to change say It's border colour when the user places the mouse over it.
....wondered if I could...make the button appear "different" when mouse over occurs.
Duh.. that's why you can make the border color appear different when you mouseover, if you desire.
;D ;D Just giving you a hard time.  You want even more, as do we all.

Quote from: andy1966 on October 19, 2015, 05:42:38 AM
I.e. change it's shape, or make it look 3D etc or make it stand out in some way.
I might be able to let you do it by letting you create a 2nd hidden button and switch between the buttons
It's not as easy as you might think.
Mouseover involves setcapture() and ReleaseCapture() of the mouse relative to the movement of the mouse and the button. I'd have to catch the moment the original button was going to change its border color and and have it send you a message to switch and do the same thing to switch back.
Also, I haven't looked yet, I've also got find a way to flag that option>

A totally different image would provide the most flexibility and I will pursue that option as opposes to just changing the shape, etc.

Hope this isn't something you want real fast.

Is this still for your ODBC?

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Larry,

After taking your advice, I decided to try two buttons.

One shown and one hidden - the buttons have different styles / shapes etc.

I can calculate when the mouse is over button 1 which is then hidden and button 2 is shown.

The reverse happens when the mouse is not over the button area.

I tried changing the screen resolution but it still worked okay, some people have reported that changing the screen res stops this from working - and yet for me It works.

Will test some more, but if this turns out okay, think It's a solution for me.

Will post the code when I have done more testing.

Thanks,
Andy.
:)

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Andy,
If you can't make yours rock solid for your needs let me know and I'll give adding the feature to the library internally.

How about a screen shot of your 2 different buttons.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Larry,

The offer is very kind of you, I know you have a lot to do as it is, I will let you know how I get on.

Attahced is a word doc, in it are:
page 1 - mouse not over button 1
page 2 - mouse over button 1 - button 1 hidden, button 2 shown instead.

Move the mouse away from the button and the window reverts to showing button 1 again.

Thanks,
Andy.
:)

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

I don't have Word and can't see what you are doing.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Go to OPENOFFICE.ORG  and download the suite.  It will allow you to read .DOC and .XLS files and manipulate them.  It is a freeware version of MS office 2003, does not handle XLSX or DOCX files, but it does the older versions.

Bill
When all else fails, get a bigger hammer.

Andy

This is what I have so far....

You need Larry's custom button add-on to compile this.

Move the mouse over button 1 and then move it away again.

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

I have noticed that when I have two sets of buttons (4 in total - 2 of 2) that the mouse coordinates are not changed from the previous button to the other when I move the mouse quickly.

When this happens obviously the button does not hide and does not show the new style button.





Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Andy, can you dummy me up a program to look at so I can see it do that?


Also, don't forget that you can do some pretty nice things with the @RGNBUTTON if you are just wanting to jazz up a rather plain button and don't really need the special features in my button library.
So don't overlook its features. ;)
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Larry,

Attached is the program with "two" buttons.

I found the problem occurs "sometimes" when I move the mouse left to right / right to left from one button to another horizontally.

Yes, those other features worth a look at too.

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

I'll have to have a look at the code and see if I can figure out why.
It appears to only do it when moving from one custom button to another
and not from a button and then back to the same custom button or from a custom button to a regular button to custom and back or vice versa.

Got to be reason.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Larry,

Regular buttons also appear to have the same problem.

There is a gap albeit small between the buttons, it seems that the mouse position is not detected whilst "over" this gap between the two controls when the mouse is moved quickly and horizontally between them.

Could this be a timing issue for the mouse position detection / function - case @IDMOUSEMOVE - OR more likely my code?

Thanks,
Andy.






Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

Perhaps this phenomenon can be avoided by inserting a WAIT statement in your code?
Support Amateur Radio  -  Have a ham  for dinner!

Andy

Hi Egil,

Puzzled how to implement the WAIT command, but thanks for that and any suggestions.

What I have found so far:
Thought I would try using the starttimer function to see if I could update the mouse position "quicker", however when I use the timer function and print or setcaption of window with the locations @mousex and @mousey they always show zero instead of their position?

So no luck there...

Will keep trying different things, there must be a way.
Andy.




Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

Hi Andy,

Sorry for making you confused. What I really meant was to use sleep(int milliseconds).
By calling sleep, your program is halted with the number of milliseconds you specify. That way windows message handler is able to catch up with any message(s) before dealing with the next message from your program.
Remember to $include "windowssdk.inc" before using.

This little trick has saved me from going insane a couple of times.


Egil
Support Amateur Radio  -  Have a ham  for dinner!

Andy

Thanks Egil,

I tried sleep and other things but now I have got it working!

The trick was to "forget" IDMOUSEMOVE.

I used a timer AND GetCursorPos(pt) together.

Attached is the working code - I will post a new version of this in User Offerings as I think this is a very handy bit of code.

Thanks,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

Glad you got it working, Andy.

Tried to compile your code after purchasing the button library, but I was not able to find the CBLM2.inc file anywhere in the install. In fact the only files containing the term CBLM2 in their names was the help files. So guess I have to contact at least one of the Larrys to straighten things out.

Support Amateur Radio  -  Have a ham  for dinner!

Andy

Hi Egil,

I've posted another version that does not require the custom button library in the "User Offerings" section of the forum.

Thought the CBLM2.INC file was included? It's a long time since I installed the custom button library.

Andy.
:)

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Quote from: Egil on October 23, 2015, 05:18:00 AM
Glad you got it working, Andy.

Tried to compile your code after purchasing the button library, but I was not able to find the CBLM2.inc file anywhere in the install. In fact the only files containing the term CBLM2 in their names was the help files. So guess I have to contact at least one of the Larrys to straighten things out.


Egil
After a quick glance it appears the installer for the button lib was last updated before IWB quit using the registry. If the installer doesn't find IWB it doesn't install several files.
You're the first to run into this. Gives you some indication the volume of sales we have.  ;D  And since LarryS handles all sales and puts the money in the pot for the site I have no idea when someone buys one of my programs.

I've got yet another Dr's within the hour.  When I get back I will start working on re-writing the installer for the for button lib. I should be able to get it done and posted within the next 24 hours.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

No problems Larry!
I am not in a hurry, as I still have problems sitting down after the hip replacement.

Gives you some indication the volume of sales we have.  Grin

Well, guess your sales just grew 200% then. I purchased both the button and the chart libraries.... :D


Egil

Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

I reckon I'll retire from retirement then!..... yah-hoooo!!!  ;D ;D ;D ;D
Now I can live the fat life.

Thanks Egil

Don't have time to look right now but you might have the same problem with the installer on the chart lib.
I'll look when I get back.  I'm out the door now.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Bruce Peaslee

I just downloaded the grid control and it installed OK. It is a nice piece of work. Now that you are un-retired, you might consider charging a little for it.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

LarryMc

Quote from: peaslee on October 23, 2015, 10:00:15 AM
...It is a nice piece of work....
That's payment enough.  Thank you sir.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Bill-Bo

LarryMc,

Where do you get the grid control?

Bill