Hi all,

I have a generic toolbar with buttons to create records, delete records, next record, previous record etc.

When the user is in a datasource that can only be queried, the buttons to create and delete records should be disabled. Similar situations exist for all buttons.

So i need to turn on and off buttons. Is that possible? How?

If yes, is there an API to change the icon for the button? I would like to grey out the button so the user sees that the button has no use.

I have found api_component.setvisible, but i do not want to totally hide the buttons because when the user navigates through the application, continuously buttons will appear and disappear.

Kind regards, Jan Willem

asked 21 Sep '15, 04:34

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1231331
accept rate: 0%

Hi Jan Willem,

Keep in mind that if you disable the save button by default and the user opens a form and just edit 1 field without leaving the field it looks like he cannot save the changes because the save button is still disabled... The save actually works by clicking this disabled save button, because the valueChanged event triggers and enables the button, so the click works, but for the user this is not intuitive (clicking a disabled save button...)

For this reason i chose to hve the save button alsways enabled, and give a message in the status bar that there are no changes to save when he clicks the button when there are no changes.

Best, Michiel

(21 Sep '15, 05:09) Michiel A

Hi Jan,

To achieve your request, you can use api_component.setEnable API. You can turn off a button by setting its enabled property to N and turn it on by setting its enabled property to Y via this API.

This API also automatically greys out the button and its icon, I guess it will meet your need. However, you can always use api_component.setIcon API to change the icon of a component.

Regards,
Ibrahim

link

answered 21 Sep '15, 04:49

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

Many thanks Ibrahim, this works perfectly.

Kind regards, Jan Willem

(21 Sep '15, 06:17) Jan Willem V...
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×10
×3
×3
×2

Asked: 21 Sep '15, 04:34

Seen: 840 times

Last updated: 21 Sep '15, 06:17


© Copyright Gerger 2017