[MSEide-MSEgui-talk] Variable scoping;

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[MSEide-MSEgui-talk] Variable scoping;

mohamed hamza
Hi Martin,

I created 3 forms

Form1:
tMgrDbo= class(tmseform)

oDs:tmsedatasource;
procedure OnEnterPanel(const sender: TObject);

procedure tMgrDbo.OnenterPanel(const sender:TObject);
oDs.dataset:= tdbwidgetgrid(sender).datasource.dataset;

Form2:
tfrmDataCli=class(tMgrDbo)
ttabwidget1: ttabwidget;
ttabpage1: ttabpage;
ttabpage2: ttabpage;

Form3:
TfrmInfoCli01=class(tmseform)
TDBwidget1: TDBwidget;
procedure OnenterPanel(const sender: TObject);

Uses
frmDatacli;

procedure tfrmInfoCli01.OnenterPanel(const sender: TObject);
frmdataclifo.onEnterPanel(sender);


The problem is:

When the OnEnterPanel(sender) is fired from form3  oDs  propertie is not visible in Form1?

Error Segmentation fault.

Watch window gives can not access memory address oDs.

What is wrong ?

Best Regards.

Med


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mse
Administrator
On Friday 12 October 2018 13:04:49 mohamed hamza wrote:
> Hi Martin,
>
> I created 3 forms
>
[...]
Please send an example which shows the problem otherwise any answer will be
pure guesswork.

Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mohamed hamza
Here  the example 

Regards.

Med

De : Martin Schreiber <[hidden email]>
Envoyé : vendredi 12 octobre 2018 11:23
À : [hidden email]
Objet : Re: [MSEide-MSEgui-talk] Variable scoping;
 
On Friday 12 October 2018 13:04:49 mohamed hamza wrote:
> Hi Martin,
>
> I created 3 forms
>
[...]
Please send an example which shows the problem otherwise any answer will be
pure guesswork.

Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

newd.rar (17K) Download Attachment
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mse
Administrator
On Friday 12 October 2018 16:28:05 mohamed hamza wrote:
> Here  the example
>
Is this what you wanted to achive:
"
var
 f3fo: tf3fo;
implementation
uses
 f3_mfm,f2,main;
procedure tf3fo.onEnter(const sender: TObject);
begin
 mainfo.f2fo1.onEnter(sender); <<<<<------
end;
"
?
Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mohamed hamza
Excuse  me, but in the hurry I gave you a bad example with an unforgiven error.

As an attachment there is the real example.  

Med.


De : Martin Schreiber <[hidden email]>
Envoyé : vendredi 12 octobre 2018 15:42
À : [hidden email]
Objet : Re: [MSEide-MSEgui-talk] Variable scoping;
 
On Friday 12 October 2018 16:28:05 mohamed hamza wrote:
> Here  the example
>
Is this what you wanted to achive:
"
var
 f3fo: tf3fo;
implementation
uses
 f3_mfm,f2,main;
procedure tf3fo.onEnter(const sender: TObject);
begin
 mainfo.f2fo1.onEnter(sender); <<<<<------
end;
"
?
Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

newn.tar.gz (11K) Download Attachment
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mse
Administrator
On Friday 12 October 2018 21:50:32 mohamed hamza wrote:
> Excuse  me, but in the hurry I gave you a bad example with an unforgiven
> error.
>
> As an attachment there is the real example.
>
"
procedure tmainfo.onCreated(const sender: TObject);
begin
 f2fo:= tf2fo.create(application); //<<<<----
  //or better:
// application.createform(tf2fo,f2fo);
       //register for cross form component linking
end;
"


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mohamed hamza
Is it better  to  create a tabwidget  in mainform and working with ongetsubform event .Then I do not have to create window and freei it. The Rad do it for me?

Oncreate Mainform()

ttabpage1.tago:=(f_11);
.....
ttabpagen.tagpo:=(f_nn);

OngetSubForm()
submoduleclass:=widgetclassty(ttabpage(sender).tag);

So  application.create(tfn,fn) is eliminated?  and also to free it

Med



De : Martin Schreiber <[hidden email]>
Envoyé : samedi 13 octobre 2018 09:48
À : [hidden email]
Objet : Re: [MSEide-MSEgui-talk] Variable scoping;
 
On Friday 12 October 2018 21:50:32 mohamed hamza wrote:
> Excuse  me, but in the hurry I gave you a bad example with an unforgiven
> error.
>
> As an attachment there is the real example.
>
"
procedure tmainfo.onCreated(const sender: TObject);
begin
 f2fo:= tf2fo.create(application); //<<<<----
  //or better:
// application.createform(tf2fo,f2fo);
       //register for cross form component linking
end;
"


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mse
Administrator
On Saturday 13 October 2018 17:04:15 mohamed hamza wrote:

> Is it better  to  create a tabwidget  in mainform and working with
> ongetsubform event .Then I do not have to create window and freei it. The
> Rad do it for me?
>
> Oncreate Mainform()
>
> ttabpage1.tago:=(f_11);
> .....
> ttabpagen.tagpo:=(f_nn);
>
> OngetSubForm()
> submoduleclass:=widgetclassty(ttabpage(sender).tag);
>
> So  application.create(tfn,fn) is eliminated?  and also to free it
>
Yes, an example is here:
https://gitlab.com/mseide-msegui/mseuniverse/tree/master/samples/forms/formintabpage

Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mse
Administrator
On Sunday 14 October 2018 10:57:54 Martin Schreiber wrote:

> On Saturday 13 October 2018 17:04:15 mohamed hamza wrote:
> > Is it better  to  create a tabwidget  in mainform and working with
> > ongetsubform event .Then I do not have to create window and freei it. The
> > Rad do it for me?
> >
> > Oncreate Mainform()
> >
> > ttabpage1.tago:=(f_11);
> > .....
> > ttabpagen.tagpo:=(f_nn);
> >
> > OngetSubForm()
> > submoduleclass:=widgetclassty(ttabpage(sender).tag);
> >
> > So  application.create(tfn,fn) is eliminated?  and also to free it
>
> Yes, an example is here:
> https://gitlab.com/mseide-msegui/mseuniverse/tree/master/samples/forms/form
>intabpage
>
Needs MSEide+MSEgui current git master version.

Martin




_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mohamed hamza
Well done . Really your example must  be referenced in google database under the keyword:

Creating Dynamic Form using  MseIde Msegui  Or  in mseide-msegui-talk with an other thread : Variable scoping is not appropriate.

Best Regards.

Med

 

De : Martin Schreiber <[hidden email]>
Envoyé : dimanche 14 octobre 2018 09:26
À : [hidden email]
Objet : Re: [MSEide-MSEgui-talk] Variable scoping;
 
On Sunday 14 October 2018 10:57:54 Martin Schreiber wrote:
> On Saturday 13 October 2018 17:04:15 mohamed hamza wrote:
> > Is it better  to  create a tabwidget  in mainform and working with
> > ongetsubform event .Then I do not have to create window and freei it. The
> > Rad do it for me?
> >
> > Oncreate Mainform()
> >
> > ttabpage1.tago:=(f_11);
> > .....
> > ttabpagen.tagpo:=(f_nn);
> >
> > OngetSubForm()
> > submoduleclass:=widgetclassty(ttabpage(sender).tag);
> >
> > So  application.create(tfn,fn) is eliminated?  and also to free it
>
> Yes, an example is here:
> https://gitlab.com/mseide-msegui/mseuniverse/tree/master/samples/forms/form
>intabpage
>
Needs MSEide+MSEgui current git master version.

Martin




_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mohamed hamza
Suppose we have 2  grids inside teditpage1  and we want to change dso.dataset according to the grid
we  selected. 
we  create event in baseeditpagefo 

Onenter:
dataso.dataset:=tdbstringgrid(sender).datalink.datasource.dataset;

this assignment is not considered  in baseeditfo.dataso :
We keep the dataset that we have loaded with submodule?

Med

De : mohamed hamza <[hidden email]>
Envoyé : dimanche 14 octobre 2018 09:41
À : General list for MSEide+MSEgui
Objet : Re: [MSEide-MSEgui-talk] Variable scoping;
 
Well done . Really your example must  be referenced in google database under the keyword:

Creating Dynamic Form using  MseIde Msegui  Or  in mseide-msegui-talk with an other thread : Variable scoping is not appropriate.

Best Regards.

Med

 

De : Martin Schreiber <[hidden email]>
Envoyé : dimanche 14 octobre 2018 09:26
À : [hidden email]
Objet : Re: [MSEide-MSEgui-talk] Variable scoping;
 
On Sunday 14 October 2018 10:57:54 Martin Schreiber wrote:
> On Saturday 13 October 2018 17:04:15 mohamed hamza wrote:
> > Is it better  to  create a tabwidget  in mainform and working with
> > ongetsubform event .Then I do not have to create window and freei it. The
> > Rad do it for me?
> >
> > Oncreate Mainform()
> >
> > ttabpage1.tago:=(f_11);
> > .....
> > ttabpagen.tagpo:=(f_nn);
> >
> > OngetSubForm()
> > submoduleclass:=widgetclassty(ttabpage(sender).tag);
> >
> > So  application.create(tfn,fn) is eliminated?  and also to free it
>
> Yes, an example is here:
> https://gitlab.com/mseide-msegui/mseuniverse/tree/master/samples/forms/form
>intabpage
>
Needs MSEide+MSEgui current git master version.

Martin




_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mse
Administrator
On Sunday 14 October 2018 21:27:43 mohamed hamza wrote:
> Suppose we have 2  grids inside teditpage1  and we want to change
> dso.dataset according to the grid we  selected.
> we  create event in baseeditpagefo
>
> Onenter:
> dataso.dataset:=tdbstringgrid(sender).datalink.datasource.dataset;

Or in better in teditpage1 where we better know the type of "sender"
parameter?
"
implementation
uses
 editpage1form_mfm,editform;

procedure teditpage1fo.enterev(const sender: TObject);
begin
 editfo.dataso.dataset:= tdbstringgrid(sender).datalink.datasource.dataset;
end;
"
>
> this assignment is not considered  in baseeditfo.dataso :
> We keep the dataset that we have loaded with submodule?
>
Yes, we can use it as "maindatasource" for the DB-edit widgets of the editpage
form. Don't set its datasource property if you don't need it or use a base
form without datasource component.

Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mohamed hamza
According to your advice, we have to duplicate the code  onGetSubModule() , onInitSubmodule for each tabwidget we manage with mainMenu of myMainform and duplicate onEnterDbWidget for each tabPage.I think the code will not be optimized. What is your opinion?

Med



De : Martin Schreiber <[hidden email]>
Envoyé : lundi 15 octobre 2018 09:54
À : [hidden email]
Objet : Re: [MSEide-MSEgui-talk] Variable scoping;
 
On Sunday 14 October 2018 21:27:43 mohamed hamza wrote:
> Suppose we have 2  grids inside teditpage1  and we want to change
> dso.dataset according to the grid we  selected.
> we  create event in baseeditpagefo
>
> Onenter:
> dataso.dataset:=tdbstringgrid(sender).datalink.datasource.dataset;

Or in better in teditpage1 where we better know the type of "sender"
parameter?
"
implementation
uses
 editpage1form_mfm,editform;

procedure teditpage1fo.enterev(const sender: TObject);
begin
 editfo.dataso.dataset:= tdbstringgrid(sender).datalink.datasource.dataset;
end;
"
>
> this assignment is not considered  in baseeditfo.dataso :
> We keep the dataset that we have loaded with submodule?
>
Yes, we can use it as "maindatasource" for the DB-edit widgets of the editpage
form. Don't set its datasource property if you don't need it or use a base
form without datasource component.

Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mse
Administrator
On Wednesday 17 October 2018 17:57:00 mohamed hamza wrote:
> According to your advice, we have to duplicate the code  onGetSubModule() ,
> onInitSubmodule for each tabwidget we manage with mainMenu of myMainform

see MSEuniverse 2379ee9d51b9fa8f1b234516859d0a33494f7986, it has a base form
for tabwidget edit forms.

> and duplicate onEnterDbWidget for each tabPage.

I think that is OK because it must be handled specifically for the according
edit widgets. If you have many different "two grid pages" make a common
ancestor which inherits from tbaseeditpagefo.

It is also possible to use idbeditfieldlink and igriddatalink in
tbaseeditfo.onfocusedwidgetchanged:
"
procedure tbaseeditfo.focusedwidgetchangedev(const oldwidget: twidget;
               const newwidget: twidget);
var
 intf1: idbeditfieldlink;
 intf2: igriddatalink;
begin
 if (newwidget <> nil) then begin
  if newwidget.getinterface(idbeditfieldlink,intf1) then begin
   dataso.dataset:= intf1.getfieldlink().dataset;
  end
  else begin
   if newwidget.getinterface(igriddatalink,intf2) then begin
    dataso.dataset:= intf2.getdatalink().dataset;
   end;
  end;
 end;
end;
"

Martin

PS: What kind of application are you building?


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mohamed hamza
If you have many different "two grid pages" make a common
ancestor which inherits from tbaseeditpagefo.

  It's Ok but the dbnav in baseform will not be aware of the change?
 
 
Med.



De : Martin Schreiber <[hidden email]>
Envoyé : jeudi 18 octobre 2018 08:58
À : [hidden email]
Objet : Re: [MSEide-MSEgui-talk] Variable scoping;
 
On Wednesday 17 October 2018 17:57:00 mohamed hamza wrote:
> According to your advice, we have to duplicate the code  onGetSubModule() ,
> onInitSubmodule for each tabwidget we manage with mainMenu of myMainform

see MSEuniverse 2379ee9d51b9fa8f1b234516859d0a33494f7986, it has a base form
for tabwidget edit forms.

> and duplicate onEnterDbWidget for each tabPage.

I think that is OK because it must be handled specifically for the according
edit widgets. If you have many different "two grid pages" make a common
ancestor which inherits from tbaseeditpagefo.

It is also possible to use idbeditfieldlink and igriddatalink in
tbaseeditfo.onfocusedwidgetchanged:
"
procedure tbaseeditfo.focusedwidgetchangedev(const oldwidget: twidget;
               const newwidget: twidget);
var
 intf1: idbeditfieldlink;
 intf2: igriddatalink;
begin
 if (newwidget <> nil) then begin
  if newwidget.getinterface(idbeditfieldlink,intf1) then begin
   dataso.dataset:= intf1.getfieldlink().dataset;
  end
  else begin
   if newwidget.getinterface(igriddatalink,intf2) then begin
    dataso.dataset:= intf2.getdatalink().dataset;
   end;
  end;
 end;
end;
"

Martin

PS: What kind of application are you building?


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mse
Administrator
On Saturday 20 October 2018 11:34:36 mohamed hamza wrote:
> If you have many different "two grid pages" make a common
> ancestor which inherits from tbaseeditpagefo.
>
>   It's Ok but the dbnav in baseform will not be aware of the change?
>
The common ancestor with the two grids has the code
"
procedure tdoublegridpagefo.enterev(const sender: TObject);
begin
 editfo.dataso.dataset:= tdbwidgetgrid(sender).datalink.datasource.dataset;
end;
"

Probably the simplest solution for your case is the already showed use of
igriddatalink and idbeditfieldlink in onfocusedwidgetchanged event of
tbaseeditfo:
"
procedure tbaseeditfo.focusedwidgetchangedev(const oldwidget: twidget;
               const newwidget: twidget);
var
 intf1: idbeditfieldlink;
 intf2: igriddatalink;
begin
 if (newwidget <> nil) then begin
  if newwidget.getinterface(idbeditfieldlink,intf1) then begin
   dataso.dataset:= intf1.getfieldlink().dataset;
  end
  else begin
   if newwidget.getinterface(igriddatalink,intf2) then begin
    dataso.dataset:= intf2.getdatalink().dataset;
   end;
  end;
 end;
end;
"

Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mohamed hamza
Ok.

I use   a dbgroup object  ( I uploaded some  time ago :

Is it compatible with the procedure :focusedwidgetchangedev?

Med

Ps: tdoublegridpagefo.enterev  is not usefull for me.BbaseEditfo is not aware  of that change.

De : Martin Schreiber <[hidden email]>
Envoyé : samedi 20 octobre 2018 13:35
À : [hidden email]
Objet : Re: [MSEide-MSEgui-talk] Variable scoping;
 
On Saturday 20 October 2018 11:34:36 mohamed hamza wrote:
> If you have many different "two grid pages" make a common
> ancestor which inherits from tbaseeditpagefo.
>
>   It's Ok but the dbnav in baseform will not be aware of the change?
>
The common ancestor with the two grids has the code
"
procedure tdoublegridpagefo.enterev(const sender: TObject);
begin
 editfo.dataso.dataset:= tdbwidgetgrid(sender).datalink.datasource.dataset;
end;
"

Probably the simplest solution for your case is the already showed use of
igriddatalink and idbeditfieldlink in onfocusedwidgetchanged event of
tbaseeditfo:
"
procedure tbaseeditfo.focusedwidgetchangedev(const oldwidget: twidget;
               const newwidget: twidget);
var
 intf1: idbeditfieldlink;
 intf2: igriddatalink;
begin
 if (newwidget <> nil) then begin
  if newwidget.getinterface(idbeditfieldlink,intf1) then begin
   dataso.dataset:= intf1.getfieldlink().dataset;
  end
  else begin
   if newwidget.getinterface(igriddatalink,intf2) then begin
    dataso.dataset:= intf2.getdatalink().dataset;
   end;
  end;
 end;
end;
"

Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mse
Administrator
On Saturday 20 October 2018 15:58:20 mohamed hamza wrote:
> Ok.
>
> I use   a dbgroup object  ( I uploaded some  time ago :
> https://gitlab.com/mseide-msegui/mseuniverse/tree/master/samples/db/dbgroup
> )
>
> Is it compatible with the procedure :focusedwidgetchangedev?
>
I don't know. What does tdbgroup?
>
> Ps: tdoublegridpagefo.enterev  is not usefull for me.BbaseEditfo is not
> aware  of that change.

"editfo" is a "tbaseeditfo"? If you can't access the "editfo" instance
variable use
"
 tbaseeditfo(window.owner).dataso.dataset:=
             tdbstringgrid(sender).datalink.datasource.dataset;
"

Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mohamed hamza
But I am in EditPageNform (baseEditPageForm) ?
Do I have to include baseeditForm in uses of baseEditPageForm?

Med.

Ps: I am coming from  Harbour Programming Language and I have to do some conversion.
the Programming concept of this one is different from MseIde.



De : Martin Schreiber <[hidden email]>
Envoyé : samedi 20 octobre 2018 14:23
À : [hidden email]
Objet : Re: [MSEide-MSEgui-talk] Variable scoping;
 
On Saturday 20 October 2018 15:58:20 mohamed hamza wrote:
> Ok.
>
> I use   a dbgroup object  ( I uploaded some  time ago :
> https://gitlab.com/mseide-msegui/mseuniverse/tree/master/samples/db/dbgroup
> )
>
> Is it compatible with the procedure :focusedwidgetchangedev?
>
I don't know. What does tdbgroup?
>
> Ps: tdoublegridpagefo.enterev  is not usefull for me.BbaseEditfo is not
> aware  of that change.

"editfo" is a "tbaseeditfo"? If you can't access the "editfo" instance
variable use
"
 tbaseeditfo(window.owner).dataso.dataset:=
             tdbstringgrid(sender).datalink.datasource.dataset;
"

Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] Variable scoping;

mse
Administrator
On Saturday 20 October 2018 17:54:36 mohamed hamza wrote:
> But I am in EditPageNform (baseEditPageForm) ?
> Do I have to include baseeditForm in uses of baseEditPageForm?
>
Yes, not necessarily in baseeditpageform but in the form where the code
"
 tbaseeditfo(window.owner).dataso.dataset:=
             tdb*grid(sender).datalink.datasource.dataset;
"
is located.

Or use the method with tbaseeditfo.onfocusedwidgetchanged, probably the
simplest. Will TDBgroup be focused? If so use
"
procedure tbaseeditfo.focusedwidgetchangedev(const oldwidget: twidget;
               const newwidget: twidget);
var
 intf1: idbeditfieldlink;
 intf2: igriddatalink;
 daso1: tdatasource;
begin
 if (newwidget <> nil) then begin
  if newwidget.getinterface(idbeditfieldlink,intf1) then begin
   dataso.dataset:= intf1.getfieldlink().dataset;
  end
  else begin
   if newwidget.getinterface(igriddatalink,intf2) then begin
    dataso.dataset:= intf2.getdatalink().dataset;
   end
   else begin
    if newwidget is tdbgroupbox then begin
     daso1:= tdbgroupbox(newwidget).datasource;
     if daso1 <> nil then begin
      dataso.dataset:= daso1.dataset;
     end;
    end;
   end;
  end;
 end;
end;
"
(not tested!).

Martin


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
12