[[https://www.revelation.com/|Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community]]
==== Read-Only Controls (OpenInsight Specific) ====
=== At 10 NOV 1998 04:58:12PM Dave Pociu wrote: ===
{{tag>"OpenInsight Specific"}}
I'm trying to find the STYLE setting ( or corresponding property) that will make all controls READ-ONLY.
I emphasized READ-ONLY because I do not want to totally disable them. I want the user to still be able to put a cursor in the field, but I don't want them to be able to change the data inside it.
Some thing similar is done automatically by OI when one tries to access a record that's locked by a different workstation.
TIA
Dave
----
=== At 10 NOV 1998 05:37PM cpates@sprezzatura.com,[url=http://www.sprezzatura.com]Sprezzatura Ltd[/url] wrote: ===
Dave,
I assume we are talking about standard edit controls here? This is a weird one, you need to use the SendMessage API call with the EM_SETREADONLY message (which is WM_USER + 31 ) to set it, but you have to check the style to see if it is set..
eg to set
Equ WM_USER$ To 1024
Equ WM_SETREADONLY$ To WM_USER$ + 31
hwndEdit=Get_Property( CtrlEntID, "HANDLE" )
Call SendMessage( hwndEdit, WM_SETREADONLY$, TRUE$, 0 )
Carl Pates
Sprezzatura Ltd
----
=== At 10 NOV 1998 06:01PM Dave Pociu wrote: ===
Carl,
As usual, thank you!
Dave
----
=== At 11 NOV 1998 04:53AM Oystein Reigem wrote: ===
Carl,
Many thanks from me to!!!
I remember I struggled a lot with getting controls read-only. I got so frustrated when I tried to make edit boxes read-only by disabling them and discovered I could no longer scroll!!! I finally solved the problem in an altogether different, and not very satisfactory, fashion. But in my new app I'll do it your way!
(Hahaha! I just checked my several megs of notes and found I've saved a posting from you about this in 1996!)
- Oystein -
----
=== At 11 NOV 1998 11:25AM B. Cameron wrote: ===
Dave,
I've had to do the same thing. What I did was for each form
in the create event was at first read the CTRLMAP and loop
through disabling everything that was a Text or Group etc.
This became cumbersome so I found that just disabling the
delete and save allowed the user to do anything but no changes
would take effect.
if (@username # {whatever}) then
Set_Property(@WINDOW:".MENU.FILE.DELETE","ENABLED",0) Set_Property(@WINDOW:".MENU.FILE.SAVE","ENABLED",0) end
Hope this helps. Bruce
----
=== At 12 NOV 1998 10:41AM Oystein Reigem wrote: ===
Bruce,
But then fields can be edited, so the user will believe he is allowed to change the row - until he tries to save the changes. That's not nice either.
- Oystein -
----
=== At 12 NOV 1998 10:46AM Oystein Reigem wrote: ===
Bruce,
But then fields can be edited, so the user will believe he is allowed to change the row - until he tries to save the changes. That's not nice either.
- Oystein -
----
=== At 12 NOV 1998 05:16PM Dave Pociu wrote: ===
Oystein,
I agree with you, so I'm thinking of a possible workaround.
What I'm thinking is to use Bruce's idea, but add a hidden text label.
When the window is read-only, make that text label visible ( with something that stands out like red letters on yellow background) saying READ-ONLY!!!
I would then have that label on all my forms, and create a standard procedure that gets called to check the user permission and enable/disable the corresponding menus and the label.
----
=== At 12 NOV 1998 05:17PM B. Cameron wrote: ===
Oystein,
Well it is a quick fix, yes.
For me I needed all controls to be enabled.
The users know they are in "View Only" mode
as I changed the window title depending on
what the @username was/is.
You could quickly add a "No changes allowed" message.
Bruce
----
=== At 10 MAR 2003 10:27AM Bertil Strom wrote: ===
Is it possible to set an edittable to read-only (or protected) this way, using the code supplied by Carl.
Bertil
[[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=NONWORKS_READ&SUMMARY=1&KEY=B5CB7C35ED05ED88852566B80078AF71|View this thread on the forum...]]