Hello; I am attempting to modify the properties on a look-up form that is called from the current form. I thought such a reference might look like this: Global LookUpFormVar: Form LookUpFormVar.ControlName.ControlProperty := NewValue; It seems that the controls on the look-up form, and therefore their properties, and not exposed at design-time, which causes compiler errors. Is there a way to do this? Many thanks, Brian.
You will not be able to alter the form properties with your global var attempt. Even when running as the active form, using the CurrForm.*, only allows you to change a few properties at runtime. Best regards, Soren Nielsen, moderator Navision Online User Group
You can define a function on the lookup form that sets the properties based on parameters passed to it. This function can then be called from the current form.
quote:
Originally posted by Jack Reynolds: You can define a function on the lookup form that sets the properties based on parameters passed to it. This function can then be called from the current form.
Thanks for the suggestion. I’m coding it up now. Brian.
Jack; I tried the approach you suggested – sort of. I defined a function to receive a parameter, which is copied to a global in the look-up form. Unfortunately, beofre OnShowForm is called, which interprets the parameter passed in through the function, the global var is zeroed out. I believe this is due to ‘Init’ clearing all globals (and that it happens unconditionally before OnShowForm.) I have also tried setting control properties in the function that I have defined on the look-up. This doesn’t seem to work either. However, explicitly changing control properties in OnShowForm does work. So … CurrForm.“Control Name”.VISIBLE(TRUE); … produces the right behaviour. I just need to get a value in to conditionally execute a series of these statements. Ex: IF iControlValue = 0 THEN CurrForm.Control_1.VISIBLE(TRUE); IF iControlValue = 1 THEN CurrForm.Control_2.VISIBLE(TRUE); … Open to suggestions, Brian.
Yes, but it seems the VISIBLE() method of control can be successfully executed. This is the one I’m interested in at the moment. Brian.
Well you have to declare your form as a variable you call. The FORM.RUN(MyForm) will not work, as this clears the variable you sat. So have a function like: SetParameter() where you set the flag. MyForm.SetParameter(TRUE); MyForm.RUN; could probably do what you are looking for. Soren Nielsen, moderator Integration/Developer NOLUG
Your suggestion (“declare your form as a variable you call”) works. Many thanks, Brian.