Normal Topic ReadOnly Subforms (Read 1540 times)
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
ReadOnly Subforms
Dec 4th, 2004 at 7:12am
Print Post Print Post  
Is it possible to use Visibility/ReadOnly on a subform element on a TabPage ?  I have not been able to find a way to do this. (1.0.5Beta)

Here is structure:
Main form has three tabs: A,B,C
Tab A has multiple common elements for Orders.
Tab B only has one element, a subform SF3, for Order Item details during entry of Main form.
Tab C only has one element, a subform SF4, for Order Item details during updates of Main form.

Want Tab C with subform SF3 to be invisible if Main form is  @ADD, but visible when @UPDATE.
Want Tab B with subform SF4 to be invisible if Main form is  @UPDATE, but visible when @ADD.

-------------
Tried to make the TabPage invisible:
Tried Visibility(Tab A,1), Visibility(Tab B,0), did not work.
Tried Visibility(Tab A,0), Visibility(Tab B,1), did not work.
------------
Since tabs cannot be invisible, then make the subforms invisible:
Tried Visibility(SF3,1), Visibility(SF4,0), did not work.
Tried Visibility(SF3,0), Visibility(SF4,1), did not work.
---------------------
Ok, lets make the Tabs ReadOnly then:
Tried ReadOnly(Tab A,1), ReadOnly(Tab B,0), did not work.
Tried ReadOnly(Tab A,0), ReadOnly(Tab B,1), did not work.
-----------
Since I could not make the TabPages ReadOnly, my fourth choice was to make the sub forms ReadOnly
Tried ReadOnly(SF3,1),  ReadOnly(SF4,0), did not work.
Tried ReadOnly(SF3,0),  ReadOnly(SF4,1), did not work.
---------------------------------------------------------
All of these attempts are in the programming section of the Main form, On Form Entry.  All references to the subform were to the element name bound to the subform, not to the subform name.

=============================
The original plan was to have both SF3 and SF4 in same position on Tab B, and toggle visibility of the subform based on @ADD/@UPDATE, no need for Tab C.  When this appeared not to work, I then created Tab C and moved SF4 from Tab B to Tab C, to toggle the TabPages vs. the forms.  The original plan is still my preferred choice.
--------------
My next attempt will probably be to make a GlobalValue that toggles when Main form is @Add/@UPDATE.  Then I will have the programming in the sub forms SF3/4 check condition of Global Value and make every element invisible or ReadOnly.

(I have also thought of changing colors to make background and foreground same color, but that is only a trick to the eyes,. Cusrsor could still go into "hidden" elements and data could be changed/deleted/added).

But I am hoping I have been working on this for too long and have missed the obvious.

The goal: Have two (or more) subforms in same physical position on a Tab Page and have only one visible based on Main form mode of @ADD/@UPDATE.
----------
Hmmmm, I never did make both the Tab and the sub form on that page both invisible at the same time.  I just tried the Tab alone first, and it did not work.  Then I did the sub form alone, but not the Tab, and it did not work.  Wonder if I need to do both the Tab and the subform?  Will have to try that tomorrow.

Suggestions are welcome and encouraged.  Thanks for your ideas.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: ReadOnly Subforms
Reply #1 - Dec 4th, 2004 at 2:30pm
Print Post Print Post  
Bob,

Visibility() cannot affect subforms as a whole. A special SBasic routine for subform visibility was added in 1.0.2.
SubformVisibility(element_name, state).

You make a subform readonly by making all the elements on it readonly.

Setting visibility on individual tab pages isn't going to work very well. Tab groups work by making only the tab page you clicked on visible and the rest invisible. Therefore, the tab mechanism itself will keep overriding your visibility setting.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: ReadOnly Subforms
Reply #2 - Dec 4th, 2004 at 8:18pm
Print Post Print Post  
SubformVisibility(element_name, state). Grin Roll Eyes Grin

I knew it was going to be obvious!  I guess one drawback of coming from Q&A is the tendency not to look at/for new functions because so much gets done with the old ones.  Getting to know the new ones as the need arises.   Time to go back in and review the whole lisr of functions again.Roll Eyes

I just found it in the 103 Supplement.  Noted that the element name must be in quotes vs. the "normal" Visibility function for other elements.

That should do it.....will get back on it tonight.

(At least I learned of things that I can't do!  Thanks for the explanations.).

Thanks Erika!
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: ReadOnly Subforms
Reply #3 - Dec 5th, 2004 at 9:57am
Print Post Print Post  
That did the trick.  Thanks for the help.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged