Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid Current Control

Status
Not open for further replies.

manpaul

Technical User
Jan 10, 2005
118
CA
I am have a problem change the current control (Or I should say I do not know how to to this)

I want the control to change when a field value from a table is a certain value.
I have tried many varations of this code. I have also thried the code in the grid.init grid.Beforerowcolchange

IF order_details.odstatus = 2
thisform.pgfCustcare.pagorders.grid1.colinvoiced.DynamicCurrentControl = "text1"
ELSE
thisform.pgfCustcare.pagorders.grid1.colinvoiced.dynamicCurrentControl = "check1"
ENDIF

Any Ideas
 
Try:

IF order_details.odstatus = 2
thisform.pgfCustcare.pagorders.grid1.colinvoiced.text1.setfocus
ELSE
thisform.pgfCustcare.pagorders.grid1.colinvoiced.check1.setfocus
ENDIF

Jim
 
That code froze the program

What I want is status = 1
I want the display the check box that has a controlsource of odinvoiced which is a locical field from the table.
Otherwise
I want to display the text1 box which has a controlsource of invno.

This sort of work only it displayed to odinvoiced value in the field T or F not the check box or if true the invno?

IF order_details.odstatus = 2
thisform.pgfCustcare.pagorders.grid1.colinvoiced.DynamicCurrentControl = ["Text1"]
ELSE
thisform.pgfCustcare.pagorders.grid1.colinvoiced.dynamiccurrentControl = ["Check1"]
ENDIF

 
I have work on it a little more and go to this,but now I get a value incompatiable error

thisform.pgfCustcare.pagorders.grid1.colinvoiced.DynamicCurrentControl = [(iif(order_details.odstatus=2,'Text1','check1'))]
thisform.pgfCustcare.pagorders.grid1.colinvoiced.ControlSource = [(iif(order_details.odstatus=2,'order_details.invno','order_details.odinvoiced'))]

Trying everything I know
 
OK, step by step...
In the init event of your form put the following:

Code:
thisform.pgfCustcare.pagorders.grid1.colinvoiced.DynamicCurrentControl = [iif(order_details.odstatus = 2,'Text1','check1')]

Next, go to your grid and make sure you have a column named colinvoiced, and that it contains two controls, Text1 and Check1. AND, look at the ControlSource property of the colInvoiced column object and make sure that it is empty.

Now, go down select the two controls that the column contains (disregard header, I am not referring to it) and make sure that the Text1 control has a controlsource of order_details.invno and that the Check1 control has a control source of order_details.odinvoiced.

One More thing, if order_details.odinvoiced is a logical field set the value of the check1 to .F., but if order_details.odinvoiced is a numeric field then set it to 0. This step is probably not totally necessary but a good practice and will save you headaches with checkboxes and Type MisMatch errors in the future.

Finally, run your form and you should have the desired results (barring mistakes in spellings, missing items that you thought were there but aren't etc.)



boyd.gif

 
Hi ManPaul.

What I want is status = 1
I want the display the check box that has a controlsource of odinvoiced which is a locical field from the table.
Otherwise
I want to display the text1 box which has a controlsource of invno.

In order for DynamicCurrentControl to work properly, you also need to set the column's sparse property to .F.

Personally, I would just display both columns in the grid rather than trying to display 2 different fields in a single grid column. I think that what you are trying to implement is going to be very confusing for your users.





Marcia G. Akins
 
Marica and Graig

Thanks for your response, That is what the clients want
If the line item is invoiced they want to show the invoice number and not see the check box. Graig I'll be trying your solutions today and if it will nit work I'll use Marica solution od having two columns.

Thanks Both


 
Hi ManPaul.

If the line item is invoiced they want to show the invoice number and not see the check box

If they want to see (at a glance) which items have been invoiced, you could use DynamicBackColor to highlight the rows that have already been invoiced. This will certainly be easier for the users to see than looking for either a checkbox or a textbox in the grid row.

Just a thought....


Marcia G. Akins
 
Marica

That was already done, and I did put a second field on the grid which is the invoice number.

Thanks Again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top