locked
Make a checkbox invisible in a grid for certain records RRS feed

  • Question

  • I use wfp 9 sp2 and win xp.

    In a grid I have two columns. The first has a text box and the second a check box. I want the check box only visible if the first column is empty. Is that possible?

    The first column stores an email. If the person does not have email I want to check the box, but if he has, but we don't know it yet, I will not check the box. I guess I could use the .null. feature and not use the second column, but still.

    Regards,

    Jan Nordgreen

    Saturday, October 2, 2010 9:02 AM

Answers

  • Hi Jan,

    You could probably use the DynamicCurrentControl setting to display different kind of controls:

    In the Grid.init:
    This.Column2.DynamicCurrentControl = "IIF(empty('yourField'),'Check1','Text1')"

    This would then change the whole control record by record, (and you could also use an empty label as placeholder instead of that text1-control), but IMHO the effect wouldn't be very pleasing. 

    I haven't fully grasped your usecase for that checkbox though, but I have the unpleasent feeling ;) that there must be a different way to resolve your need instead of hiding a checkbox.

     


    wOOdy
    Microsoft Visual FoxPro Technology Advisor
    Microsoft "Most Valuable Professional" from 1996 to 2009
    Visit my XING profile! Don't know what XING is?

    *´¨)
    ¸.·´¸.·*´¨) ¸.·*¨)
    (¸.·´. (¸.·` *
    .·`.Visual FoxPro: It's magic !
    (¸.·``··*


     

    Saturday, October 2, 2010 9:17 AM

All replies

  • check setall() method I think it will solve your problem

    • Proposed as answer by jasvee Saturday, October 2, 2010 9:13 AM
    Saturday, October 2, 2010 9:13 AM
  • Hi Jan,

    You could probably use the DynamicCurrentControl setting to display different kind of controls:

    In the Grid.init:
    This.Column2.DynamicCurrentControl = "IIF(empty('yourField'),'Check1','Text1')"

    This would then change the whole control record by record, (and you could also use an empty label as placeholder instead of that text1-control), but IMHO the effect wouldn't be very pleasing. 

    I haven't fully grasped your usecase for that checkbox though, but I have the unpleasent feeling ;) that there must be a different way to resolve your need instead of hiding a checkbox.

     


    wOOdy
    Microsoft Visual FoxPro Technology Advisor
    Microsoft "Most Valuable Professional" from 1996 to 2009
    Visit my XING profile! Don't know what XING is?

    *´¨)
    ¸.·´¸.·*´¨) ¸.·*¨)
    (¸.·´. (¸.·` *
    .·`.Visual FoxPro: It's magic !
    (¸.·``··*


     

    Saturday, October 2, 2010 9:17 AM
  • Hi Jurgen,

    It worked perfectly. Thank you!

    It looks a bit strange to have just some check boxes turn up in different rows, but it highlights who is missing an email address perfectly and when they are checked who does not have an address.

    Regards,

    Jan Nordgreen

    Thursday, October 7, 2010 9:01 AM