Add combo boxes to a display form at runtime
Does anyone know if its possible to add a number of combo boxes or text boxes to a display form at runtime? I've seen in the forums that you can add buttons at runtime but not other forms of input. For any of the Cityworks Extension customers out there, this is to be able to handle "custom categories and fields".
Thanks in advance
Geoff
0
-
I believe it is doable using the Geocortex Essentials WPF API ("C:\Program Files (x86)\Latitude Geographics\Geocortex Essentials\Default\Workflow Designer\Geocortex Essentials WPF API.chm"), however, I have not yet had an instance to need to do this. It would be fairly complicated.
An easier method would be to create your form items before hand and set the IsVisible to False. Then use Runtime Modifications to toggle their visibility when needed. I am not familar with the Cityworks Extension so I don't know if this would work.0 -
Thanks Tom
That would work. My only concern is the space these invisible form items take. If I had to default say 5 invisible combo boxes, 5 invisible text areas, and 5 invisible data pickers to be able to handle permutiations of what I need to present coming from the CityworksAPI, I'm thinking it would create some odd looking forms with gaps. Any ideas on how that could be potentially managed at runtime?
Cheers,
Geoff0 -
Everything should collapse when not visible. I have not noticed any spacing issues for FormItems that are not visible. We've used this method for several years on lots of different workflows. 0 -
Hi Geoff,
Yes, you can create new form items on the fly.
You have to create the item.new Geocortex.Forms.Client.Items.ComboBoxFormItem()Then assign your properties to it. Be sure to give it an ArgumentName otherwise it won't be included in the results.
Then add it to the form's FormItems collection using the AddToCollection<FormItem> activity.
To get at the results of form items added on the fly you will need to use the "Form Results" output of the Display Form activity. This is a dictionary keyed by the Argument Names.
That said... I like Tom's suggestion. You don't need to actually create the controls on the fly, you can apply most of your layout and settings with the visual designer rather than in code and you can access the results of items right off the Display Form activity's design surface. Hidden form items don't take up any space, so your end users won't see a difference.
--Ryan0 -
Thanks guys.Just took the Display Forms course and it went into just what you're talking about Ryan. I should be off to the races.
-Geoff0 -
Hi Geoff,
I am using the Cityworks extension as well. I am new to the Extension and the workflows in general. I saw you comments about adding custom fields/categories. I was wondering if you had it working? Thanks. Nataliya0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
6 Kommentare