-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Is there a quick way for setting all components in a window to read only
I´m not so experienced with ZK, but as a Swing developer I suggest you to retrieve the top component (root component) of the window and then to iterate over the children components setting up the read only property when it´s possible.
I hope this help
Cheers
Gyo
Hi davout,
You can also bind a boolean with the property read-only of each component
Like that:
<zscript> boolean readonlyMode = false; </zscript> <textbox id="1" readonly="@{readonlyMode}"/> <textbox id="2" readonly="@{readonlyMode}"/> <textbox id="3" readonly="@{readonlyMode}"/> <button onClick="readonlyMode=true; binder.loadAll();"
The best answer by far!
Say that I have a CRUD window and a set of control buttons like: New, Edit, Save and Cancel - where each button is responsible for a kind of operation, as you can see.
When the window is showed all the editable components are in read-only mode then when the "New" button is pressed those components has the read-only mode turned off (they can by edited) and finally when the save/cancel button is pressed those components are in read-only mode again.
How could I handle this?
Cheers
Gyo
Hi gyowanny,
have a look at this thread and study the code.
this
What you can see is:
-------------------------------
...
4. CRUD operations in the dialogWindow with readonly/edit modus.
Stephan
PS: Not in this code is a buttonController that can visible/not visible the buttons
for the next possible CRUD operation . Hope i can post it this evening.
Asked: 2009-03-25 13:05:09 +0800
Seen: 357 times
Last updated: Mar 25 '09