How to display read-only input form

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

How to display read-only input form

4D Tech mailing list
From a listbox view, I’d like to open the input form for a record but not allow the user to change any info. I tried using DISPLAY RECORD instead of MODIFY RECORD, but it just displays the form and immediately closes. If I set the table to read only before loading the record, MODIFY RECORD just shows an alert complaining that the record is locked, and doesn’t show the input form. So I set the form fields to be not enterable, but while text can be selected, it can’t be copied.

I thought about using DIALOG, but that would require specifying the input form name in a variable higher up the call chain, because while we can use FORM SET INPUT to set the input form for a table, there is no accompanying "Form Get Input” command that I can find. I know this could probably be plugged into form storage instead of a process variable in V17, but I’m not on v17 yet and logically that’s not much different than using a process variable, we’re still introducing a separate place to store some data that we should be able to get the same way we specify it.

Is there a convenient way to mimic the ease of DISPLAY SELECTION / MODIFY SELECTION to allow read/only or read/write access when using a listbox? Is DIALOG the only option?

Also, is there a way to make a field non-enterable but allow text to be copied?

Jim Crate

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to display read-only input form

4D Tech mailing list
the only solution I found was:
variables.

Built the form with variables. - variable are enterable. User can tab
through the variables, copy text, and even change the data - but the if
they change the data it reverts to the original value(s)

with this idea in mind, object methods, or form method:

Case of
:(on data change) // I was lazy - and just reassigned everything
  reassign original value to variable
   or
  reassign all variables the underlying record data
end case

On Wed, 6 Feb 2019 13:31:19 -0800, Jim Crate via 4D_Tech wrote:
>
> Also, is there a way to make a field non-enterable but allow text to
> be copied?
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to display read-only input form

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Sure on load use command

Object set enterable(*;”@“;false)// This will set all fields and variables to non enterable

You will have to use Object set enabled for Check Boxes, Radio button etc. These can not be done as above as it will set all to disabled

You could also do a start transaction on form, only have a cancel button and cancel transaction in that. I think option one is better

I would also set background color to illustrate that stuff can not be entered

Regards


Chuck
------------------------------------------------------------------------------------------------
 Chuck Miller Voice: (617) 739-0306
 Informed Solutions, Inc. Fax: (617) 232-1064      
 mailto:cjmiller<AT SIGN>informed-solutions.com
 Brookline, MA 02446 USA Registered 4D Developer                
       Providers of 4D and Sybase connectivity
          http://www.informed-solutions.com 
------------------------------------------------------------------------------------------------
This message and any attached documents contain information which may be confidential, subject to privilege or exempt from disclosure under applicable law.  These materials are intended only for the use of the intended recipient. If you are not the intended recipient of this transmission, you are hereby notified that any distribution, disclosure, printing, copying, storage, modification or the taking of any action in reliance upon this transmission is strictly prohibited.  Delivery of this message to any person other than the intended recipient shall not compromise or waive such confidentiality, privilege or exemption from disclosure as to this communication.

> On Feb 6, 2019, at 4:31 PM, Jim Crate via 4D_Tech <[hidden email]> wrote:
>
> From a listbox view, I’d like to open the input form for a record but not allow the user to change any info. I tried using DISPLAY RECORD instead of MODIFY RECORD, but it just displays the form and immediately closes. If I set the table to read only before loading the record, MODIFY RECORD just shows an alert complaining that the record is locked, and doesn’t show the input form. So I set the form fields to be not enterable, but while text can be selected, it can’t be copied.
>
> I thought about using DIALOG, but that would require specifying the input form name in a variable higher up the call chain, because while we can use FORM SET INPUT to set the input form for a table, there is no accompanying "Form Get Input” command that I can find. I know this could probably be plugged into form storage instead of a process variable in V17, but I’m not on v17 yet and logically that’s not much different than using a process variable, we’re still introducing a separate place to store some data that we should be able to get the same way we specify it.
>
> Is there a convenient way to mimic the ease of DISPLAY SELECTION / MODIFY SELECTION to allow read/only or read/write access when using a listbox? Is DIALOG the only option?
>
> Also, is there a way to make a field non-enterable but allow text to be copied?

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to display read-only input form

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Can you call Modify Record with code either lock and reload the record(s), or disable entry for all objects?

Keith - CDI

> On Feb 6, 2019, at 3:31 PM, Jim Crate via 4D_Tech <[hidden email]> wrote:
>
> From a listbox view, I’d like to open the input form for a record but not allow the user to change any info. I tried using DISPLAY RECORD instead of MODIFY RECORD, but it just displays the form and immediately closes. If I set the table to read only before loading the record, MODIFY RECORD just shows an alert complaining that the record is locked, and doesn’t show the input form. So I set the form fields to be not enterable, but while text can be selected, it can’t be copied.
>
> I thought about using DIALOG, but that would require specifying the input form name in a variable higher up the call chain, because while we can use FORM SET INPUT to set the input form for a table, there is no accompanying "Form Get Input” command that I can find. I know this could probably be plugged into form storage instead of a process variable in V17, but I’m not on v17 yet and logically that’s not much different than using a process variable, we’re still introducing a separate place to store some data that we should be able to get the same way we specify it.
>
> Is there a convenient way to mimic the ease of DISPLAY SELECTION / MODIFY SELECTION to allow read/only or read/write access when using a listbox? Is DIALOG the only option?
>
> Also, is there a way to make a field non-enterable but allow text to be copied?
>
> Jim Crate
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to display read-only input form

4D Tech mailing list
In reply to this post by 4D Tech mailing list
I have simulated that effect with code like this:

If (Read only state([Docs])) & (Form event=On After Edit)
        vContent:=[Docs]Content
End if

Where vContent is editable (no entry filter).

Keith - CDI

> On Feb 6, 2019, at 3:31 PM, Jim Crate via 4D_Tech <[hidden email]> wrote:
>
> Also, is there a way to make a field non-enterable but allow text to be copied?
>
> Jim Crate

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to display read-only input form

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Jim,
If the table is in read only mode you can use any form you want and the
user can't edit the data.
I'd just put the table in read only and use DIALOG with the input form.

On Wed, Feb 6, 2019 at 1:32 PM Jim Crate via 4D_Tech <[hidden email]>
wrote:

> Is there a convenient way to mimic the ease of DISPLAY SELECTION / MODIFY
> SELECTION to allow read/only or read/write access when using a listbox? Is
> DIALOG the only option?
>
tl:dr

Yep but call it 'best' option.

You didn't say which version of 4D we're talking about but it sounds like
an old one so I'm going to assume you're working in v15 at least. If it's
earlier than that it's probably not worth the effort to re-work it. You
know, you _could_ drop a Tesla drive train into an '92 Impala with a lot of
work and money. Or you could fix your '92 Impala with parts from another
'92 Impala. Chip is right about using variables. I did that in v13. It's
tedious, takes pages of code and is hard to change. Put the effort into
convincing the client to upgrade. So-

Make a form and display it using DIALOG in a new process. The form contains
a listbox. In v15 it could be named selection based or array based. Doesn't
really matter - just avoid selection based. Why? Because the idea is to
have a persistent list of records selected by the user. The actual
selection may change based on what the user does in the detail form. In v17
it could be an entity selection instead.

Feel free to add a quick search box above the listbox for the user to find
records quickly on a small set (like 1) criteria with the option for a more
involved query.
Depending on the type of data this list can be pretty concise or it may be
larger. If the records are fairly concise think about having the input form
right there on the dialog. This could be a subform or you could add the
fields directly. The user clicks on a record in the list and you load the
record. I like to include a button that toggles between READ ONLY and READ
WRITE. Default to read only. The uses can click around the list and records
pop up. If they need to edit something toggle the record to READ WRITE.

The advantage of a subform is you can easily swap the table you're looking
at (the listbox doesn't really care) and simply set a different subform to
the subform object.

If this is a converted database check the compatibility settings regarding
displaying fields in dialogs. For newer versions this already baked in.

Alternatively you could also pop the user selected record into a new
process for editing. This makes it easy to let the user open multiple
records from the same table in multiple windows.

OK, this crazy talk - you want to go old school: show a list and double
click to open the input form.
Fine, take all that input stuff off the dialog and add some more fields to
it. For the On double click event you toggle the table into READ WRITE,
load the record and then display it in the input form using DIALOG again.
There's nothing wrong with Modify record but DIALOG is more flexible
precisely because it's ambivalent to read write state. If the record is
locked the user can't change anything.

I've been using this approach in v15 databases for years now and it
generalizes easily to v17+. In fact it's really much easier to implement in
v17 than the old school Modify Selection approach, in my opinion.

I realize I've thrown out a lot of options here. The thing is they are all
based on a fairly small set of principles and techniques. That's what's so
cool - you have all that flexibility from using DIALOG, a listbox and some
processes.

--
Kirk Brooks
San Francisco, CA
=======================

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to display read-only input form

4D Tech mailing list
In reply to this post by 4D Tech mailing list
DIALOG is quite capable of handling input / output forms, as long as you have activated the "make fields enterable in dialog" compatibility setting (since v2004).

there is no need to use F. SET INPUT or F. SET OUTPUT.

a list type subform or selection based listbox have their own input form defined in their property list, which is independent of the current input form (F. Get input). what is more, you can always FILTER EVENT the On Double Clicked event and do something else.

for example, you can have a 5 page dialog (=project form) with a list type subform or listbox on page 1.

the double click event could switch to pages 2, 3, 4, or 5 depending on the context by filtering the event and issuing a F. GOTO PAGE.

the current page is effective your current input form.

> 2019/02/07 6:31、Jim Crate via 4D_Tech <[hidden email]>のメール:
>
> I thought about using DIALOG, but that would require specifying the input form name in a variable higher up the call chain, because while we can use FORM SET INPUT to set the input form for a table, there is no accompanying "Form Get Input” command that I can find. I know this could probably be plugged into form storage instead of a process variable in V17, but I’m not on v17 yet and logically that’s not much different than using a process variable, we’re still introducing a separate place to store some data that we should be able to get the same way we specify it.




**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to display read-only input form

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Hi Jim,

Have you tried MODIFY SELECTION instead of MODIFY RECORD?
Set the table in read only mode, make sure only the requested record is in the current selection and then open the record using MODIFY SELECTION. Without the. optional * parameters, this command should open it immediately in the input form for a one record selection.
If I remember correctly, no lock alert will be shown.

Otherwise you might try to use an error handler to get rid of the alert.

If a field is set to focusable but not enterable, the user can't edit the content, but will be able to select and copy.

HTH
Koen

> Op 6 feb. 2019, om 22:31 heeft Jim Crate via 4D_Tech <[hidden email]> het volgende geschreven:
>
> If I set the table to read only before loading the record, MODIFY RECORD just shows an alert complaining that the record is locked, and doesn’t show the input form. So I set the form fields to be not enterable, but while text can be selected, it can’t be copied.



--------------------
Compass bvba
Koen Van Hooreweghe
Kloosterstraat 65
9910 Aalter
Belgium
tel +32 495 511.653

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to display read-only input form

4D Tech mailing list
Koen,
Nice -
I did not know that

Chip

On Thu, 7 Feb 2019 10:19:04 +0100, Koen Van Hooreweghe via 4D_Tech
wrote:
>
> If a field is set to focusable but not enterable, the user can't edit
> the content, but will be able to select and copy.
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to display read-only input form

4D Tech mailing list
In reply to this post by 4D Tech mailing list

> Le 6 févr. 2019 à 22:31, Jim Crate via 4D_Tech <[hidden email]> a écrit :
>
> [...]
> I thought about using DIALOG, [...]

I would stop using legacy display commands (display/modify selection, add/modify record… maybe I forget some). IMHO 4D modern way to display a form is dialog, dialog or dialog.

--
Arnaud de Montard



**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to display read-only input form

4D Tech mailing list
In reply to this post by 4D Tech mailing list
On Feb 7, 2019, at 1:19 AM, Koen Van Hooreweghe via 4D_Tech <[hidden email]> wrote:
>
> Have you tried MODIFY SELECTION instead of MODIFY RECORD?
> Set the table in read only mode, make sure only the requested record is in the current selection and then open the record using MODIFY SELECTION. Without the. optional * parameters, this command should open it immediately in the input form for a one record selection.
> If I remember correctly, no lock alert will be shown.

While the general consensus is that DIALOG is the way forward, I’ll try this for now since it should work with the code as it is.  In more user-oriented parts of the system, I am building more dynamic interfaces with subforms and such but for a quick “let me search and display data in this table” admin view this is convenient and easy.

> If a field is set to focusable but not enterable, the user can't edit the content, but will be able to select and copy.

This works exactly as I wanted. Thanks!

Jim Crate

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************