Normal Topic FormViewType (Read 1392 times)
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
FormViewType
Jul 8th, 2009 at 6:12pm
Print Post Print Post  
This should be simple, but it's not working for me - where is my error?   Will FormViewType("Form", FORM_VIEW_TYPE_FORM) work on a subform if the code is initiated from the parent form?  

I wish to change the SOLines subform from tableview to Formview (on Form Entry it presents in Form view)
Parent form Orders,  Subform SOLines ...

If (@FormViewType("SOLines") = FORM_VIEW_TYPE_TABLE)
   {
     FormViewType("SOLines", FORM_VIEW_TYPE_FORM)
     ForceRedraw()
   }

I can write code that changes the view from form to table, but the code doesn't work when attempting to change from table to form (I can do it with a command button on SOLines, but I wish to accomplish that with a print command button on the parent form Orders).
  

Larry
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: FormViewType
Reply #1 - Jul 8th, 2009 at 7:00pm
Print Post Print Post  
Was the table you are trying to turn into a form created as a table initially?

Subforms that start their lives as tables cannot be toggled.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: FormViewType
Reply #2 - Jul 8th, 2009 at 8:16pm
Print Post Print Post  
Hi Mark,

No, the subform starts as a 'formview' form.  I have a toggle command button in the subform so that the user can see in one glance the line items, quantities, and pricing for that order.  But then I need the subform to be returned to formview before printing the order.  I can have the users do that manually with a message box reminder, but doing that in code would be much more elegant
  

Larry
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: FormViewType
Reply #3 - Jul 8th, 2009 at 8:53pm
Print Post Print Post  
Put the form in table view, then run the code in the conditional, but without the condition - to see if the problem is in reporting the view type or in the toggle itself. If it toggles, then put a writeln on the function in the condition, and see what it is returning. If it doesn't toggle then start looking for something that is interfering with it.

Also, fill up your code with writeln statements, so you can see what is going on.
Also, does Shift-F6 work in the same spot?

If nothing is coming to you, adapt your code to work inside the example app: Gems.db to see if there are any unknown factors.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: FormViewType
Reply #4 - Jul 8th, 2009 at 9:36pm
Print Post Print Post  
Mark,

I will try your suggestions.

fyi, I put a command button on the parent form Orders, and put the following code in the OnElementEntry event of the button ...
If (@FormViewType("SOLines") = FORM_VIEW_TYPE_TABLE)
    {
     FormViewType("SOLines", FORM_VIEW_TYPE_FORM)
     ForceRedraw()
    }
if SOLines is in table view, nothing happens

But, if I put this following code in the button,
SubformVisibility("LE0", 0)
       ForceRedraw()

then the subform disappears, as instructed by the code.  So I know that some code from the parent will impact my subform, but not (yet) the FormViewType command.

nothing happens
  

Larry
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: FormViewType
Reply #5 - Jul 9th, 2009 at 12:32am
Print Post Print Post  
Mark, ??,

I made 2 new forms, PracMain and PracSub.  I then made PracSub a subform element of Pracmain and named the subform element PracSub.
     I added a  single command button to the PracMain parent with this code ...

formviewtype("PracSub", 0)    ....... it didn't work.

But when I went into the PracMain layout and renamed the subform element from PracSub to Psub,   the code worked like a charm, changing the tableview of the form PracSub (subform element Psub) to formview.

Could the problem be that the name of the subform (SOLines) is also the name of the subform element (SOLines) on the parent form (Orders)?  I believe I remember reading something about this in an InsideSesame issue, I'll look for it.
  

Larry
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: FormViewType
Reply #6 - Jul 9th, 2009 at 12:38am
Print Post Print Post  
Give it a try. Its always a good idea to name everything uniquely.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: FormViewType
Reply #7 - Jul 9th, 2009 at 2:18pm
Print Post Print Post  
can toggle the SOLines subform from table to form using the Application Commands Menu, no problem.  Can build a command button on the Parent form that toggles the SOLines subform from form to table.   But if I change the command button code to try and toggle the subform from table to form, no joy.  Gots me bamboozled.
  

Larry
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: FormViewType
Reply #8 - Jul 9th, 2009 at 3:06pm
Print Post Print Post  
I found a problem (using Gems) and have fixed it. The fix will be in the next release. I'm sorry for the inconvenience.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: FormViewType
Reply #9 - Jul 10th, 2009 at 3:30am
Print Post Print Post  
Finally - A code problem that can't be traced to my dimness !!!  Yeeeeeeehaaaaaaahhhhh!

Seriously, not a problem.  I'm happy the fix is on the way.  Thanks, Mark.
  

Larry
Back to top
IP Logged