Normal Topic Subform Element Attribute control (Read 821 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Subform Element Attribute control
Jul 24th, 2007 at 8:00pm
Print Post Print Post  
Is there a way I can change an attribute on an element contained in the subform from the parent form? (I want to make a specific  element on the subform visible or not visible) I have played with a number of commands like Attribute()with no success.

I have a transactions tableview subform that contains the history of charges and payments on a specific property. If the bal due is not 0 when a pay off demand command button is selected  I am using GotoTabPage() command to display the tableview subform in the middle of my form and directing the user with a popup  to “select” transactions to include on payoff demand. They do this by clicking in a small box (element) that is at the beginning of the row. (all other elements on subform are read only) This works well for this one task, however many other tasks use the same tableview subform on that tab and it is a distraction to have this extra element visible at any time other then pay off demand generation.

Ideally I would like to make my element transactionShowPOD visible at the time the command button is pressed prior to the GotoTabPage().

I hope this is somewhat clear.

Thanks
           
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Subform Element Attribute control
Reply #1 - Jul 24th, 2007 at 8:19pm
Print Post Print Post  
Hello Robert,

A parent form can not directly access the properties of an element on a subform. You can however cause a piece of code on the subform to run that will show or hide the element that you want by using FormRunProgram(). Let me know if you'd like an example, I made a quick one to test that it works.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Subform Element Attribute control
Reply #2 - Jul 24th, 2007 at 8:56pm
Print Post Print Post  
Once again Ray you save the day. I missed  FormRunProgram() completely

I created an element named visibilitycontrol and made it non visible and put this code in on entry program

#include "sbasic_include.sbas"

     Attribute(TransactionShowPOD, ATTR_ID_VISIBILITY,1)
     ForceRedraw()


Then I added this line to my Generate POD button


FormRunProgram("payments", "visibilitycontrol", PROGRAM_EVENT_LE_enter)

It works great!

Thanks and thanks again and again!
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Subform Element Attribute control
Reply #3 - Jul 24th, 2007 at 8:59pm
Print Post Print Post  
Hello Robert,

You're probably gonna find that you are going to need to turn it back to invisible for other records, unless you have other code taking care of that.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Subform Element Attribute control
Reply #4 - Jul 24th, 2007 at 9:03pm
Print Post Print Post  
Thanks for the thought! I handled that at the end of the POD procedure.

Do you think I need the ForceRedraw() ? I tried it both ways and did not see a difference, however I almost always include it when I am changing anything to do with visibility.

Thanks
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Subform Element Attribute control
Reply #5 - Jul 25th, 2007 at 3:45am
Print Post Print Post  
BOBSCOTT wrote on Jul 24th, 2007 at 8:56pm:
I created an element named visibilitycontrol and made it non visible and put this code in on entry program

#include "sbasic_include.sbas"

     Attribute(TransactionShowPOD, ATTR_ID_VISIBILITY,1)
     ForceRedraw()

Be careful about using #include "sbasic_include.sbas" in multiple events. It will greatly extend the time it takes to test your programming, and the time it takes to compile when opening the form. I only place it in Global Code. That way it only needs to be processed once, and is still available to all the other events.

I ran a test to see exactly what the impact would be. I placed #include "sbasic_include.sbas" in 34 events. It took forever to test the program, and it took almost 100 seconds to open the form in preview. Then, I removed those lines from everywhere except Global Code, and the form opened in under 9 seconds. (I left the other programming that I had in those 34 events.)
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Subform Element Attribute control
Reply #6 - Jul 25th, 2007 at 3:51am
Print Post Print Post  
Thanks for the great advice. It is greatly appreciated!
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged