Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to change a button color ?
#1
Hi Guys,

On my form I have a button that, when clicked, will search for rows in a table and show them in a grid. I want to notify the user the button click has been registered and that the application is performing the action. If the action takes longer than 500 ms, and no visual sign says the button is pressed, the user will try again, and again, and..

My client is using Edge browser and that's a company wide decision I can't change. Unlike IE, buttons in Edge do not visually change when clicked. No 3D effect. In Edge nothing happens at all, that is, there is no sign telling the user the button has been clicked. NB! It might be a setting somewhere in Edge prohibiting this behavior and if it is, and you know how to change that, please let me know. I've used a lot of time with my friend Google to try to find out, so far without luck.

Anyway, to bypass this Edge shortage, I've decided to let my button change color when clicked. The idea is to change it as soon as the user clicks it, and leave the color for the duration of the action, but absolutely none of the attempts to get the button to change color at anytime, have been successful.

I use the OnClick event of the button, not the OnAsyncClick event.

If you have an idea of how to do this, or a proposal for another approach, please let me know.

Regards
Soren
Reply
#2
you don't see the "spinning wheel" when it's working?
did you see how it works in other browsers?

you can show a small "Working..." label with a different color, maybe even blinking (with a timer)
Reply
#3
Hi EitanArbel,

Thanks for your input. No, I do not see the spinning wheel. I do see it at other times, just not in this function.

And for other browsers. In IE, you actually see the button move down and up again when you click it with the mouse. In EDGE: Nothing..

As for showing a small label with text: That's what I've been trying without success.

Regards
Soren
Reply
#4
how about replacing the IWButtons with IWGradButtons?
not only that they look cool with Color Schema Style or of your choice, but they also don't care about the browser, so they can work everywhere
Reply
#5
You mean the new Edge (Chromium based) or the old Edge? AFAIK both behave more or less the same (they both have visual clues when you press a button)...

I'd be surprised if it doesn't.

Other than that, you can use the IWGradButton as Eitan suggested. You can give them basically whatever appearance that you want.
Reply
#6
Hi Alexandre,

Sorry for this late response. It is the old Edge, but the behavior is the same in the new Edge. I've tried some more and found the folllowing:

If the color of the button is clBtnFace, hovering the mouse over the button, do change it's color to turquoise while the mouse is over. Still no indication that the button is actually being pressed though. I use standard clBtnFace for a few of the buttons on the form.

But if the color is one of the clWEBxxx colors, there are no "hovering color" when the mouse is over and absolutely no indication of whether the button is being pressed or not.

This is true for both the Old and the New Edge. However, in the new Edge there is a highlighted black frame around the focused control, allowing you easily to see which control has focus. Just not the clWEBxxx colored controls. These all have a black frame as if they all has focus at the same time, and it is impossible to see which actually has the focus.

The new Edge is fine in many ways, just not on this area. As far as I have found, it is not possible to change the focusing frame nor it's color, and until that is possible, I'm not using it.

Regards
Soren
Reply
#7
Hi Soren,


The below code should work on an IW button (make sure you have RenderjQuery=true in SC->JavaScriptOptions').

Code:
//Replace BTNREFRESH will your button name  

btnRefresh->ScriptEvents->Values["onClick"] = "$('#BTNREFRESH').css('background-color', 'red');";

Also, if you have LockOnSubmit=true, LockUntilLoaded=true on your form you should see the spinning wheel.

Regards,
Mark
Reply
#8
Hi Mark,

Thanks for the proposal. I'll give it a try.

Regards
Soren
Reply
#9
(03-17-2020, 06:18 PM)SorenJensen Wrote: Hi Mark,

Thanks for the proposal. I'll give it a try.

Regards
Soren

Hi! Did it work? I have the same issue and I've been trying to sort it out for several days from my property in lake Como
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)