Jump to content
Server Maintenance This Week. ×

Show Field on Button Press


This topic is 1092 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I want to have a set-up whereby a field is hidden until a button press "unhides"  the field.

I can hide the field by using Get(WindowMode) = 0 in the "Hide object when" section of the Inspector. I am after a script for a button that will unhide the field when the button is pressed. The closest I have come to, without success is, to create a script for the button that uses the Set Field command. This command allows you to set the target field but requires you to also enter a calculation result. I do not know what to enter or whether using the Set Field command in my script is the right way to go to achieve what I want (show the field).

Any assistance would be appreciated. 

Frank

Link to comment
Share on other sites

I don't think this is a well-defined problem. So user presses a button and a field appears. Should it appear for the current record only, or for all records? Should it appear for all users, or only for the user that pressed the button? And how long should it remain visible? For the remainder of the session? For all times?

IOW, we need an explanation of what this is really about. Why is the field hidden to begin with, and what exactly is the meaning of clicking that button? Only then we will be able to suggest a suitable mechanism.

 

28 minutes ago, fbugeja said:

The closest I have come to, without success is, to create a script for the button that uses the Set Field command. This command allows you to set the target field but requires you to also enter a calculation result. I do not know what to enter

Well, if it is a "flag" (i.e. Boolean) field, you would enter the value of 1 to turn it true.

 

Edited by comment
Link to comment
Share on other sites

Hi

I created a recipes database. One thing that I have been toying with is a field that shows from where I obtained that recipe (e.g. net, cookbook, etc). Given that info in this field can date / disappear), I only want to view this field if it is absolutely necessary e.g. I need to update a recipe from the original source, update the source of that recipe, etc

I am not really concerned if the field remains unhidden on the record I am viewing until I exit that record. 

"Clicking a button" simply means pressing a button on the same record that has the hidden field; with that button having a script to unhide the hidden field.

Changing the Get(WindowMode) value to 1 does not work. Get(WindowMode) = 1 operates in Find Mode only. Get(WindowMode) = 0 applies in Browse mode - and this is what I am doing, browsing records.

Frank

Edited by fbugeja
Link to comment
Share on other sites

7 hours ago, fbugeja said:

Given that info in this field can date / disappear), I only want to view this field if it is absolutely necessary

I don't think that really answers my questions above. If you want to display the data only on demand, perhaps you should consider showing it in a custom dialog instead of revealing a field.

Alternatively, you could format the field to hide when:

not $$showHiddenField

and make your button do:

Set Variable [ $$showHiddenField ; Value: 1 ]
Refresh Object [ Object Name: "hiddenField" ; Repetition: 1 ]

This will reveal the field when the button is clicked - and then you still have the question when to hide it again. If you want, you could have a second script triggered OnRecordLoad that does:

Set Variable [ $$showHiddenField ; Value: 0 ]
Refresh Object [ Object Name: "hiddenField" ; Repetition: 1 ]

so that the field remains visible until user goes to another record.

Or you could make the button toggle the display:

Set Variable [ $$showHiddenField ; Value: not $$showHiddenField ]
Refresh Object [ Object Name: "hiddenField" ; Repetition: 1 ]

 

Link to comment
Share on other sites

Hi Consultant

Your idea of a custom dialog immediately attracted my attention. So I tried it out on 1 record - no problem! However, if you go to any other record, you get the same commentary - no good. Only way for this method to work is to create a separate script  for every record. So if you had 200 records, you would need 200 separate scripts, each with its own commentary only applicable for that record. Not worth it!

I will try your other suggestions!

Regards

Frank

 

Link to comment
Share on other sites

1 hour ago, fbugeja said:

Only way for this method to work is to create a separate script  for every record.

Clearly, you did something wrong - but since you're not telling us exactly what you did, we cannot tell what it is. 

If you define the button to:

Show Custom Dialg [ YourTable::SomeField ]

and place it on a layout of YourTable, it will always show data from the current record in YourTable.

 

Link to comment
Share on other sites

This topic is 1092 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.