Hi
I am trying to grasp the concept of building and manipulating forms at
runtime.
I have figured out how to add controls:
FormBuildDesign formBuildDesign = form.design();
FormBuildGroupControl formBuildGroupControl;
formStringControl c, c2;
formRadioControl r;
formCheckBoxControl cbx;
formGroupControl d;
;
super();
c =
element.design().addControl(FormControlType::String,'RunTimeControl');
d = element.design().addControl(FormControlType::Group,'rtGroup');
c2 = d.addControl(FormControlType::string,'rt2');
r = d.addControl(FormControlType::RadioButton,'test');
r.caption('This is RadioGroup 1');
r.add('item 1');
r.add('item 2');
cbx = d.addControl(FormControlType::CheckBox,'Check 1');
cbx.label('Check box 1');
c.label('New Control');
c2.label('String 2');
d.caption('This is a group');
This adds a stringControl, a radiogroup with a couple of radiobuttons and a
checkbox.
As it is all done in runtime, I have no idea of how many controls are
added, nor which type they have. (In the real solution I will read the
information in a table)
I need to know a couple of things here.
1) In case I have radiobuttons, how do I find out which button is checked?
(In the example I have two radiobuttons, I want to retreive the number of
button that is checked)
2) As question 1, but with checkboxes.
3) I want the user to be able to press a button, that will delete all items
I added runtime. How do I do that? It is ok to just delete the items on the
groupcontrol, I can count these using the method "ControlCount", which in
the above example gives me 3 as answer. (one stringControl, one
radioControl and one checkbox).
If I were to do this in Delphi I would run through the componentList in a
for-loop from 0 to controlcount - , check the type with an is-operator,
typecast the control, and call its delete method.
But I have no idea of how I could do this in Axapta.
To get the big picture, here is a description of what I am trying to
achieve:
The user opens the form, behind the scenes I read a record in a database,
according to the contents of this record, I create radiobuttons or
checkboxes. The user clicks the appropriate checkboxes/radiobuttons and
presses a next button. Behind the scenes I save the choices made, clear the
form, goto next record in the table and start over.
Any help is highly appreciated. And as I'm fairly new in the wonderfull
world of Axapta.... code snippets would be really great !!
Jens Fudge
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

