Re-re hello Med and everybody.

To resume: how to use MSEDBnavigator by code.
There is a demo in /mseuniverse/samples/db/dbfilter2 and the challenge is to 
apply filter by code instead of clicking on the buttons of the navigator.

I was only able to do it changing code of msedbedit.pas and make DataLink 
public like explained in previous posts with Med (see bellow in this post).

And the code for applying filter by code is:

procedure tmainfo.onexec(const sender: TObject);
begin
 navi.datalink.execbutton(dbnb_filterclear);  // Clear the filter
 navi.datasource.dataset.filtered := true;    // Set filter on

 navi.datalink.execbutton(dbnb_filtermin);   // Set filter min
 ied.value:= 40;   // change value min integer
 navi.datalink.execbutton(dbnb_filtermin);   // Apply filter

 navi.datalink.execbutton(dbnb_filtermax);   // Set filter max
 ied.value:= 90;  // change value max integer
 navi.datalink.execbutton(dbnb_filtermax);   // Apply filter
end;

This gives the opportunity to run all the buttons of the DBnavigator by code.
And so you may use the with DBnavigator.visible := false and do your own 
buttons and code.

But maybe there is a other way to do this without making datalink public so 
please advice.

Fre;D
________________________________
De : Fred van Stappen <fi...@hotmail.com>
Envoyé : mercredi 26 octobre 2022 02:08
À : mohamed hamza <medh...@hotmail.com>
Objet : RE: FILTER

Re-re hello Med.

To do it the right way for changing msedbedit.pas, there is only needed to add 
this line in msedbedit.pas:

tdbnavigator = class(tcustomtoolbar,idbnaviglink)
  ...
published
   property datalink: tnavigdatalink read fdatalink; // add this line


So property datalink will be published and code of the button-exec (see 
previous post) will be:

procedure tmainfo.onexec(const sender: TObject);var
 sender2 : tmsebufdataset;
begin
   sender2 := tmsebufdataset(navi.datasource.dataset);
   sender2.filtered := true;  // to set filter on
   navi.datalink.execbutton(dbnb_filtermin);  // to change filtermin or 
filtermax
   ied.value:= 40;  // change value of min integer;
   navi.datalink.execbutton(dbnb_filtermin);  // execute second time to apply 
change
end;

Fre;D



________________________________
De : Fred van Stappen <fi...@hotmail.com>
Envoyé : mercredi 26 octobre 2022 01:49
À : mohamed hamza <medh...@hotmail.com>
Objet : RE: FILTER

Re-hello Med.

Ok, I did explore the demo filter2.

Mama mia, not easy to understand the Martin way.

But I was able to assign filter manually by code only when changing code of 
msedbedit.pas.

Changing this line 185 of msedbedit.pas :

 tdbnavigator = class(tcustomtoolbar,idbnaviglink)
  private
   //fdatalink: tnavigdatalink;  // no more private
  ...
   public
    fdatalink: tnavigdatalink; // make it public.


Then, in demo filter2, add a button and for onexecute:

procedure tmainfo.onexec(const sender: TObject);
var
 sender2 : tmsebufdataset;
begin
   sender2 := tmsebufdataset(navi.datasource.dataset);
   sender2.filtered := true;  // to set filter on
   navi.fdatalink.execbutton(dbnb_filtermin);  // to change filtermin or 
filtermax
   ied.value:= 40;  // change value of min integer;
   navi.fdatalink.execbutton(dbnb_filtermin);  // execute second time to apply 
change
end;

I dont know if it is what you want but for this the msegui code must be changed 
( fdatalink must be public ).
Maybe there is a other way without changing code but I dont see.

Fre;D

________________________________
De : mohamed hamza <medh...@hotmail.com>
Envoyé : mardi 25 octobre 2022 13:44
À : Fred van Stappen <fi...@hotmail.com>
Objet : RE: FILTER

Hello Fred,

Assign a filter manualy is not a problem for users and programmers,  Martin did 
it easy to understand.
But how to do it by programming .  ( say for example filtervalue ( <field> , 
fek_filter):= avalue;

Regards

Med
________________________________
De : Fred van Stappen <fi...@hotmail.com>
Envoyé : vendredi 21 octobre 2022 14:10
À : mohamed hamza <medh...@hotmail.com>
Objet : RE: FILTER

Hello Med and everybody.

About the version of MSEide and MSEgui.

There was lot of fixes since last release, maybe it is time to do a new release.

Mainly for release MSEide on ARM32 and AARCH64.
And for MSEgui lot of fixes since mse_dynpo was introduced.

With last commits and hard-deep test I do not find problems anymore on each 
CPU/OS.

Are you ok for a new release or better wait a few ?

Fre;D



________________________________
De : mohamed hamza <medh...@hotmail.com>
Envoyé : jeudi 20 octobre 2022 10:46
À : General list for MSEide+MSEgui <mseide-msegui-talk@lists.sourceforge.net>
Objet : Re: [MSEide-MSEgui-talk] FILTER

Hi Fred,

   In fact the user have to clear the filter for before setting a new one.
If we do filterMin ---->  type in a value ---> FilterOn ----> FilterMax ----> 
type in a value : Result = Max of min.


I believe that one thing we need to change in mseide.lib is to add a new 
function  ( Version.pas)   which gives the version
of lib we are using and  changing MseIde to call this one?

ShowMessage  ( ' MseIde ver XXXXX  LIB  ver())

Regards.

Med


________________________________
De : Fred van Stappen <fi...@hotmail.com>
Envoyé : mercredi 19 octobre 2022 20:53
À : General list for MSEide+MSEgui <mseide-msegui-talk@lists.sourceforge.net>
Objet : Re: [MSEide-MSEgui-talk] FILTER

Re-re hello Med:

Maybe with a video it is more easy to understand how the demo work:

https://user-images.githubusercontent.com/3421249/196801630-a1f4dace-e431-4719-8f21-a95959aea7f4.mp4

Fre;D
________________________________
De : mohamed hamza <medh...@hotmail.com>
Envoyé : mercredi 19 octobre 2022 20:32
À : General list for MSEide+MSEgui <mseide-msegui-talk@lists.sourceforge.net>
Objet : [MSEide-MSEgui-talk] FILTER

Hi all,
I think there is no more hope to change the dbfilter module in mselib?
Can someone try(, If interested mseuniverse samples/db/ dbfilter2 to see the 
bug or I am wrong. ?

You can try with integer and <=, >= operators.

Regards.

Med.

_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to