[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

Change property on form element in runtime without AutoDeclaration

michael

12/8/2005 9:16:00 PM

Hi

I have a problem that I haven't been able to find the answer to anywhere.

Basically what I am doing is the following:

I have a form containing a grid. Most of the different customers using this
form always wants changes to the grid, which is why I decided on the solution
below.

From this form they can click on a dialog to enable/disable(visible or not)
the different fields on the grid.

I have now made it so that I build the dialog by running through the
elements of the grid in run time.

I am able to get all the properties without any problems. But when they
click disable on the dialog and I want to get that change effective(runtime)
in the grid-element it doesn't show/hide the element, even though in the
debugger I can see it changing before and after. Here's the code:

------------------------
Object parentControl, childcontrol;
;
....
parentControl = element.form().design().control(TmpGrid.id());
childControl = parentControl.controlNum(UserSettings.Position);
childControl.visible(UserSettings.visible);

// I have tried all these but noone of them seem to work:
element.redraw();
this.redraw();
element.refresh();
------------------------

I really hope someone can help me with this, because I am almost considering
going back to the old crappy solution where its not dynamic.

Thanks
Michael
7 Answers

Luegisdorf

12/9/2005 2:36:00 PM

0

Hi Michael

I tried your example just with the 'Address' form and it works well:

1. Goto the AOT and to the form Address
2. Make the grid on the form Autodeclartion=true
3. Add a Button
4. The clicked Button on the form should look like this:
oid clicked()
{
Object parentControl, childcontrol;
;
parentControl = grid;
childControl = grid.controlNum(1);
childControl.visible(false);

}
5. Open the form and click the button
6. Effect should be, that first Column will be moved out (invisible)

If this this does not work with your Axapta, may be it is a version problem;
with what Version and Service Pack you work? I'm using Axapta 3.0 with SP4.

Best regards
Patrick


"Michael" wrote:

> Hi
>
> I have a problem that I haven't been able to find the answer to anywhere.
>
> Basically what I am doing is the following:
>
> I have a form containing a grid. Most of the different customers using this
> form always wants changes to the grid, which is why I decided on the solution
> below.
>
> From this form they can click on a dialog to enable/disable(visible or not)
> the different fields on the grid.
>
> I have now made it so that I build the dialog by running through the
> elements of the grid in run time.
>
> I am able to get all the properties without any problems. But when they
> click disable on the dialog and I want to get that change effective(runtime)
> in the grid-element it doesn't show/hide the element, even though in the
> debugger I can see it changing before and after. Here's the code:
>
> ------------------------
> Object parentControl, childcontrol;
> ;
> ...
> parentControl = element.form().design().control(TmpGrid.id());
> childControl = parentControl.controlNum(UserSettings.Position);
> childControl.visible(UserSettings.visible);
>
> // I have tried all these but noone of them seem to work:
> element.redraw();
> this.redraw();
> element.refresh();
> ------------------------
>
> I really hope someone can help me with this, because I am almost considering
> going back to the old crappy solution where its not dynamic.
>
> Thanks
> Michael

michael

12/9/2005 6:23:00 PM

0

Hi Patrick

I am sorry, but I forgot to mention that it is in Ax 2.5.

Since its working in 3.0, thats probably why none of the examples I found
would work.

Do you have any ideas how I could get it to work in Ax2.5?

Thanks,
Michael

"Luegisdorf" wrote:

> Hi Michael
>
> I tried your example just with the 'Address' form and it works well:
>
> 1. Goto the AOT and to the form Address
> 2. Make the grid on the form Autodeclartion=true
> 3. Add a Button
> 4. The clicked Button on the form should look like this:
> oid clicked()
> {
> Object parentControl, childcontrol;
> ;
> parentControl = grid;
> childControl = grid.controlNum(1);
> childControl.visible(false);
>
> }
> 5. Open the form and click the button
> 6. Effect should be, that first Column will be moved out (invisible)
>
> If this this does not work with your Axapta, may be it is a version problem;
> with what Version and Service Pack you work? I'm using Axapta 3.0 with SP4.
>
> Best regards
> Patrick
>
>
> "Michael" wrote:
>
> > Hi
> >
> > I have a problem that I haven't been able to find the answer to anywhere.
> >
> > Basically what I am doing is the following:
> >
> > I have a form containing a grid. Most of the different customers using this
> > form always wants changes to the grid, which is why I decided on the solution
> > below.
> >
> > From this form they can click on a dialog to enable/disable(visible or not)
> > the different fields on the grid.
> >
> > I have now made it so that I build the dialog by running through the
> > elements of the grid in run time.
> >
> > I am able to get all the properties without any problems. But when they
> > click disable on the dialog and I want to get that change effective(runtime)
> > in the grid-element it doesn't show/hide the element, even though in the
> > debugger I can see it changing before and after. Here's the code:
> >
> > ------------------------
> > Object parentControl, childcontrol;
> > ;
> > ...
> > parentControl = element.form().design().control(TmpGrid.id());
> > childControl = parentControl.controlNum(UserSettings.Position);
> > childControl.visible(UserSettings.visible);
> >
> > // I have tried all these but noone of them seem to work:
> > element.redraw();
> > this.redraw();
> > element.refresh();
> > ------------------------
> >
> > I really hope someone can help me with this, because I am almost considering
> > going back to the old crappy solution where its not dynamic.
> >
> > Thanks
> > Michael

michael

12/12/2005 6:37:00 PM

0

Anybody else have any suggestions?

"Michael" wrote:

> Hi
>
> I have a problem that I haven't been able to find the answer to anywhere.
>
> Basically what I am doing is the following:
>
> I have a form containing a grid. Most of the different customers using this
> form always wants changes to the grid, which is why I decided on the solution
> below.
>
> From this form they can click on a dialog to enable/disable(visible or not)
> the different fields on the grid.
>
> I have now made it so that I build the dialog by running through the
> elements of the grid in run time.
>
> I am able to get all the properties without any problems. But when they
> click disable on the dialog and I want to get that change effective(runtime)
> in the grid-element it doesn't show/hide the element, even though in the
> debugger I can see it changing before and after. Here's the code:
>
> ------------------------
> Object parentControl, childcontrol;
> ;
> ...
> parentControl = element.form().design().control(TmpGrid.id());
> childControl = parentControl.controlNum(UserSettings.Position);
> childControl.visible(UserSettings.visible);
>
> // I have tried all these but noone of them seem to work:
> element.redraw();
> this.redraw();
> element.refresh();
> ------------------------
>
> I really hope someone can help me with this, because I am almost considering
> going back to the old crappy solution where its not dynamic.
>
> Thanks
> Michael

Luegisdorf

12/13/2005 10:06:00 AM

0

Hi Michael

Your're right; In Axapta 2.5 the Grid controls hasn't a controlNum() method.

I see to possiblitities to make your desired functionality run:

a) add the controls in the grid manually instead using autoDataGroup, auto
declare each of them and access direct to the field controls instead with the
grid.

b) If you want use a autoDataGroup: design an empty grid and add the fields
at runtime at form startup to the grid using an iteration of the fieldgroup's
fields. You can now use controlNames like "gridCtrl_1" and can access with
"gridCtrl_" + <any valid number>.

That's the only two possiblities I see in Axapta 2.5. Solution a) is faster
done, but solution b) is more dynamicly.

Best regards
Patrick

"Michael" wrote:

> Hi Patrick
>
> I am sorry, but I forgot to mention that it is in Ax 2.5.
>
> Since its working in 3.0, thats probably why none of the examples I found
> would work.
>
> Do you have any ideas how I could get it to work in Ax2.5?
>
> Thanks,
> Michael
>
> "Luegisdorf" wrote:
>
> > Hi Michael
> >
> > I tried your example just with the 'Address' form and it works well:
> >
> > 1. Goto the AOT and to the form Address
> > 2. Make the grid on the form Autodeclartion=true
> > 3. Add a Button
> > 4. The clicked Button on the form should look like this:
> > oid clicked()
> > {
> > Object parentControl, childcontrol;
> > ;
> > parentControl = grid;
> > childControl = grid.controlNum(1);
> > childControl.visible(false);
> >
> > }
> > 5. Open the form and click the button
> > 6. Effect should be, that first Column will be moved out (invisible)
> >
> > If this this does not work with your Axapta, may be it is a version problem;
> > with what Version and Service Pack you work? I'm using Axapta 3.0 with SP4.
> >
> > Best regards
> > Patrick
> >
> >
> > "Michael" wrote:
> >
> > > Hi
> > >
> > > I have a problem that I haven't been able to find the answer to anywhere.
> > >
> > > Basically what I am doing is the following:
> > >
> > > I have a form containing a grid. Most of the different customers using this
> > > form always wants changes to the grid, which is why I decided on the solution
> > > below.
> > >
> > > From this form they can click on a dialog to enable/disable(visible or not)
> > > the different fields on the grid.
> > >
> > > I have now made it so that I build the dialog by running through the
> > > elements of the grid in run time.
> > >
> > > I am able to get all the properties without any problems. But when they
> > > click disable on the dialog and I want to get that change effective(runtime)
> > > in the grid-element it doesn't show/hide the element, even though in the
> > > debugger I can see it changing before and after. Here's the code:
> > >
> > > ------------------------
> > > Object parentControl, childcontrol;
> > > ;
> > > ...
> > > parentControl = element.form().design().control(TmpGrid.id());
> > > childControl = parentControl.controlNum(UserSettings.Position);
> > > childControl.visible(UserSettings.visible);
> > >
> > > // I have tried all these but noone of them seem to work:
> > > element.redraw();
> > > this.redraw();
> > > element.refresh();
> > > ------------------------
> > >
> > > I really hope someone can help me with this, because I am almost considering
> > > going back to the old crappy solution where its not dynamic.
> > >
> > > Thanks
> > > Michael

Kangaroo Court Australia

12/12/2010 1:01:00 PM

0

http://humanrights.change.org/petitions/view/human_rights_f......

http://kangaroocourtaustralia.../cms/index.php?/topi......

To the Secretary-General Mr Ban Ki Moon,
To the United Nations,
To the International Criminal Court,

My name is robbie thorpe
I am an Australian indigenous person
from tribe............

My People’s Future is uncertain
because we are forced to give up our Past.

My Indigenous Culture continues to be diminished
and eroded
by a White Australia,
that is Hypocritical and Criminal.

They destroy indigenous schools,
they will not allow indigenous children
to learn native languages.

Creating Conditions OF LIFE with INTENT to DESTROY.

Their Judges lie, their Prime Ministers lie, their Parliaments lie.

My people cannot speak to judges,
nor get answers from judges,
cannot get medical help,
cannot get protection under local
nor international laws.

There is widespread Oppression, Exploitation and Degradation:
of indigenous peoples,
of immigrants
and of refugees.

Human Rights are for EVERYONE,
or there will be human rights for NO ONE.

How can the United Nations
look at the Children of BURMA in the eye,
and tell them that their Human Rights
are being as sought for
and protected
as those of Australian Indigenous children’s.

How can the United Nations look at the Children of the World with
sincerity,
through the lens of Human Rights?

Are there a SET of LAWS
for Developed Nations
and another set of laws
for Underdeveloped Nations?

Whatever consent
mistakenly believed
to have been given to White Australia
in order to govern Indigenous peoples
is now formally withdrawn
by the Indigenous peoples of Australia.

forfeited by a history of
White Australia Policy,
Of Murder,
Of Genocide,
of Crimes against Humanity.

Will the United Nations confirm Australia as a sovereign Nation,
Rather than a British Colony
that has NO right to be included in the United Nations?

Sovereign Nations do NOT break Treaties.
Sovereign Nations do NOT break Local Laws.
Sovereign Nations do NOT break International Laws.

Submissions to the International Criminal Court
On the Crimes of White Australia since 2002
Have gone unanswered.

Is there a set of laws for white Australia
and another set of laws for Burma,
And other underdeveloped nations?

Perhaps, the International Criminal Court has NO jurisdiction,
Over the BRITISH COLONY of Australia?

Will the United Nations be honest with the Australian people?

Because Living in Fear
is what it means to be a,
SLAVE…

http://kangaroocourtaustralia...

Kangaroo Court Australia

12/12/2010 1:37:00 PM

0

On Dec 13, 12:00 am, Kangaroo Court Australia
<illusionz.ad...@gmail.com> wrote:
> http://humanrights.change.org/petitions/view/human_rights_f......
>
> http://kangaroocourtaustralia.../cms/index.php?/topi......
>
> To the Secretary-General Mr Ban Ki Moon,
> To the United Nations,
> To the International Criminal Court,
>
> My name is robbie thorpe
> I am an Australian indigenous person
> from tribe............
>
> My People’s Future is uncertain
> because we are forced to give up our Past.
>
> My Indigenous Culture continues to be diminished
> and eroded
> by a White Australia,
> that is Hypocritical and Criminal.
>
> They destroy indigenous schools,
> they will not allow indigenous children
> to learn native languages.
>
> Creating Conditions OF LIFE with INTENT to DESTROY.
>
> Their Judges lie, their Prime Ministers lie, their Parliaments lie.
>
> My people cannot speak to judges,
> nor get answers from judges,
> cannot get medical help,
> cannot get protection under local
> nor international laws.
>
> There is widespread Oppression, Exploitation and Degradation:
> of indigenous peoples,
> of immigrants
> and of refugees.
>
> Human Rights are for EVERYONE,
> or there will be human rights for NO ONE.
>
> How can the United Nations
> look at the Children of BURMA in the eye,
> and tell them that their Human Rights
> are being as sought for
> and protected
> as those of Australian Indigenous children’s.
>
> How can the United Nations look at the Children of the World with
> sincerity,
> through the lens of Human Rights?
>
> Are there a SET of LAWS
> for Developed Nations
> and another set of laws
> for Underdeveloped Nations?
>
> Whatever consent
> mistakenly believed
> to have been given to White Australia
> in order to govern Indigenous peoples
> is now formally withdrawn
> by the Indigenous peoples of Australia.
>
> forfeited by a history of
> White Australia Policy,
> Of Murder,
> Of Genocide,
> of Crimes against Humanity.
>
> Will the United Nations confirm Australia as a sovereign Nation,
> Rather than a British Colony
> that has NO right to be included in the United Nations?
>
> Sovereign Nations do NOT break Treaties.
> Sovereign Nations do NOT break Local Laws.
> Sovereign Nations do NOT break International Laws.
>
> Submissions to the International Criminal Court
> On the Crimes of White Australia since 2002
> Have gone unanswered.
>
> Is there a set of laws for white Australia
> and another set of laws for Burma,
> And other underdeveloped nations?
>
> Perhaps, the International Criminal Court has NO jurisdiction,
> Over the BRITISH COLONY of Australia?
>
> Will the United Nations be honest with the Australian people?
>
> Because Living in Fear
> is what it means to be a,
> SLAVE…
>
> http://kangaroocourtaustralia...

Kangaroo Court Australia

12/13/2010 3:07:00 AM

0

On Dec 13, 12:37 am, Kangaroo Court Australia
<nwn.webmas...@gmail.com> wrote:
> On Dec 13, 12:00 am, Kangaroo Court Australia
>
> <illusionz.ad...@gmail.com> wrote:
> >http://humanrights.change.org/petitions/view/human_rights_f......
>
> >http://kangaroocourtaustralia.../cms/index.php?/topi......
>
> > To the Secretary-General Mr Ban Ki Moon,
> > To the United Nations,
> > To the International Criminal Court,
>
> > My name is robbie thorpe
> > I am an Australian indigenous person
> > from tribe............
>
> > My People’s Future is uncertain
> > because we are forced to give up our Past.
>
> > My Indigenous Culture continues to be diminished
> > and eroded
> > by a White Australia,
> > that is Hypocritical and Criminal.
>
> > They destroy indigenous schools,
> > they will not allow indigenous children
> > to learn native languages.
>
> > Creating Conditions OF LIFE with INTENT to DESTROY.
>
> > Their Judges lie, their Prime Ministers lie, their Parliaments lie.
>
> > My people cannot speak to judges,
> > nor get answers from judges,
> > cannot get medical help,
> > cannot get protection under local
> > nor international laws.
>
> > There is widespread Oppression, Exploitation and Degradation:
> > of indigenous peoples,
> > of immigrants
> > and of refugees.
>
> > Human Rights are for EVERYONE,
> > or there will be human rights for NO ONE.
>
> > How can the United Nations
> > look at the Children of BURMA in the eye,
> > and tell them that their Human Rights
> > are being as sought for
> > and protected
> > as those of Australian Indigenous children’s.
>
> > How can the United Nations look at the Children of the World with
> > sincerity,
> > through the lens of Human Rights?
>
> > Are there a SET of LAWS
> > for Developed Nations
> > and another set of laws
> > for Underdeveloped Nations?
>
> > Whatever consent
> > mistakenly believed
> > to have been given to White Australia
> > in order to govern Indigenous peoples
> > is now formally withdrawn
> > by the Indigenous peoples of Australia.
>
> > forfeited by a history of
> > White Australia Policy,
> > Of Murder,
> > Of Genocide,
> > of Crimes against Humanity.
>
> > Will the United Nations confirm Australia as a sovereign Nation,
> > Rather than a British Colony
> > that has NO right to be included in the United Nations?
>
> > Sovereign Nations do NOT break Treaties.
> > Sovereign Nations do NOT break Local Laws.
> > Sovereign Nations do NOT break International Laws.
>
> > Submissions to the International Criminal Court
> > On the Crimes of White Australia since 2002
> > Have gone unanswered.
>
> > Is there a set of laws for white Australia
> > and another set of laws for Burma,
> > And other underdeveloped nations?
>
> > Perhaps, the International Criminal Court has NO jurisdiction,
> > Over the BRITISH COLONY of Australia?
>
> > Will the United Nations be honest with the Australian people?
>
> > Because Living in Fear
> > is what it means to be a,
> > SLAVE…
>
> >http://kangaroocourtaustralia...