Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 4 Jahren, 8 Monaten
Letzter Beitrag:
vor 4 Jahren, 8 Monaten
Beteiligte Autoren:
Fabrice Harari, DerekT, Peter Holemans, B.Rohde

Control-State switch to DisplayOnly with EnumControl

Startbeitrag von B.Rohde am 12.12.2013 08:28

Hi,
In the "End of initialization"-Area of my window I have code to identify my controls in the window like this:
ResControl is string
ResControl = EnumControl(WIN_Aggregate, i)
WHILE ResControl""
i++
ResControl = EnumControl(WIN_Aggregate, i)
// here should be the wanted code to set the readonly-state
END

Now I want to set the controls to DisplayOnly like "ResControl..State=DisplayOnly".
How is the right code to do this?
(I know ControlGrayed / ControlEnabled, but I only want to have a readonly state, not to change the view of the window)

Hints are welcome
B,.. Rohde

Antworten:

Hi B.,

Indirection is the way to go in this case. Like this:
{Rescontrol, indControl}..state = DisplayOnly

But why don't you add all controls into a named group (via the menu) and change the status for the complete group? Like this:
GroupName..state = DisplayOnly

This last one will certainly execute faster.
The firts option is only necessay if you dynamically create controls via ControlClone().

Cheers,

Peter H.

von Peter Holemans - am 12.12.2013 08:44
B.
The above will work but be aware that if you have the 'With selection in read-only' (Details tab of the description) checked then the user will still be able to access the control.
Changes can be made but will not be saved - can be a bit confusing.

AFAIK there is no way to change this setting progamatically.

von DerekT - am 12.12.2013 09:44
Hi

All of the above will work, but except if you want to work on all your controls EXCEPT the first one, your loop is incorrect.

If I'm right, you need to move the //'here should... section at the beginning of the loop, where the previous code makes you able to work on control number 1 BEFORE reading the second one

Best regards

von Fabrice Harari - am 12.12.2013 11:12
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.