Normal Topic [Solved] Unselected element appearing in Table (Read 447 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
[Solved] Unselected element appearing in Table
Sep 13th, 2007 at 8:17pm
Print Post Print Post  
Solution: See thread content.

In my Invoice database I have an element named Checkcode, with the label Lookup.  Unlike every other element on my form, it has a blue background.  It is a combo box which populates on-element-entry with the following code:
Code
Select All
var vCheckcodeLookups as string

// Populates the Checkcode combo box

vCheckcodeLookups = @XListValues(@FN, "Customer!Checkcode")
vCheckcodeLookups = @SortstringArray(vCheckcodeLookups,0)
vCheckcodeLookups = @Replace(vCheckcodeLookups, "&", "\&")
PopulateListElement(Checkcode, vCheckcodeLookups) 



This element is only visible in Add or Update modes, which is controlled by the following on-form-entry code:
Code
Select All
// Make the Checkcodes visible if Add or Update modes

IF (@MODE() = 0 or @MODE() = 1)
THEN Visibility(Checkcode, 1) 



Now here's what's funky:  If I do a search, retrieve some records, and then use the Table column selector to choose which columns I want displayed in Table View, it always displays in the Table View whether I've selected it or not.  It's a real puzzler.  As the table is populating (which can take a few seconds if I've retrieved all records) only the columns I've selected show.  But as soon as the table is populated, there it is!  It shows to the right of all the other columns, gloriously blue, and empty because the element never "saves" its value once it's been used.  If I click on it, "Working" flashes in the Mode box, as if it was trying to populate, but this doesn't actually happen.

Gremlins in the machine?
« Last Edit: Sep 14th, 2007 at 1:36pm by Hammer »  

**
Captain Infinity
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Unselected element appearing in Table
Reply #1 - Sep 14th, 2007 at 3:15am
Print Post Print Post  
It appears that Sesame is doing exactly what you are telling it to do. Which is basically: if you're in Add or Update modes, make CheckCode visible upon form entry. And the reason you are seeing it appear after the others columns, is because when the table is done populating, an On Form Entry event occurs as focus settles onto the first record.

You probably need to also check whether the form is in table or form view. You can do this with @FormViewType. You'll find it on page 256 in the latest programming guide.

BTW, if you want the element to be visible in Add and Update mode, you don't need to check the mode. The On Form Entry event doesn't run in Search mode anyway. I'm assuming that you have a line in On Retrieve Spec Open that is hiding it? You can probably just replace the @Mode conditional with an @FormViewType conditional.
  


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


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Unselected element appearing in Table
Reply #2 - Sep 14th, 2007 at 12:54pm
Print Post Print Post  
Quote:
It appears that Sesame is doing exactly what you are telling it to do.

I figured that was probably the case, which is why I posted my code.
Quote:
Which is basically: if you're in Add or Update modes, make CheckCode visible upon form entry. And the reason you are seeing it appear after the others columns, is because when the table is done populating, an On Form Entry event occurs as focus settles onto the first record.

Ah, dawn breaks.
Quote:
You probably need to also check whether the form is in table or form view. You can do this with @FormViewType. You'll find it on page 256 in the latest programming guide.

I'm looking at it right now, not yet sure how to use it, but I'll experiment.
Quote:
BTW, if you want the element to be visible in Add and Update mode, you don't need to check the mode. The On Form Entry event doesn't run in Search mode anyway. I'm assuming that you have a line in On Retrieve Spec Open that is hiding it? You can probably just replace the @Mode conditional with an @FormViewType conditional.

I don't quite understand that, but I'll play around.  Thanks Carl!
  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Unselected element appearing in Table
Reply #3 - Sep 14th, 2007 at 1:18pm
Print Post Print Post  
Thanks again, Carl.  I changed my on-form-entry code to the following:
Code
Select All
// Make the Checkcodes visible in Form View and invisible in Table View

Var vFormMode as Int

vFormMode = @FormViewType("INVOICE")
IF (vFormMode = FORM_VIEW_TYPE_FORM)
THEN
	{
	Visibility(Checkcode, 1)
	}
ELSE
	{
	Visibility(Checkcode, 0)
	} 


and it works happy and snappy!  Yay!
  

**
Captain Infinity
Back to top
IP Logged