0

quick way to make all components read only?

asked 2009-03-25 13:05:09 +0800

davout gravatar image davout
1429 3 18

Is there a quick way for setting all components in a window to read only

delete flag offensive retag edit

4 Replies

Sort by » oldest newest

answered 2009-03-25 13:32:04 +0800

gyowanny gravatar image gyowanny
283 1 2 6

updated 2009-03-25 13:32:48 +0800

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

link publish delete flag offensive edit

answered 2009-03-25 13:40:42 +0800

bob007 gravatar image bob007
384 3 4

updated 2009-03-25 13:43:47 +0800

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();"


regards,
Steve

link publish delete flag offensive edit

answered 2009-03-25 13:43:25 +0800

gyowanny gravatar image gyowanny
283 1 2 6

updated 2009-03-25 14:05:57 +0800

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

link publish delete flag offensive edit

answered 2009-03-25 14:27:27 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-03-25 14:29:59 +0800

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.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-03-25 13:05:09 +0800

Seen: 356 times

Last updated: Mar 25 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More