Jump to content
uniGUI Discussion Forums
rullomare

DBGRID Action Columns at Design Time

Recommended Posts

Hi,
 
Variant of the component Tunidbgrid with Columns Action At design time. 
 
This new component is the result of a collaboration between myself and Mr. Maikel Bresler. 
 
the component has been tested with version 0.96... of UniGui and Delphi XE3. 
 
I do not think that there are problems with other versions of Delphi. 
 
installation: 
 
package BMUiniDbGrid;
   ..........
   .........
 
requires
  rtl,
  vcl,
  UniGUI17;   // unigui17 = delphi XE3    >>>  Change the package Unigui17 with your version of Delphi                 
  ..........
  ..........
  .......... 
 
 
Build and install the  package BMuniDBGrid.dpk 
 
Add the Path (dcu) in Delphi>Tools>Delphi Options>Library 
 
Have Fun. 
 
 
P.Š. if you need a demo program, please let me know. 
 
 
with best regards 
 
Salvatore Marullo

post-1298-0-87433000-1407590256_thumb.pngpost-1298-0-12303300-1407590279_thumb.pngpost-1298-0-18578300-1407590294_thumb.pngpost-1298-0-91170800-1407590313_thumb.pngpost-1298-0-71767300-1407590330_thumb.pngpost-1298-0-42555200-1407590346_thumb.png

 

BMUniDBGrid.zip

 

 

  • Upvote 7

Share this post


Link to post
Share on other sites

code:

procedure JSEventHandler(AEventName:String;AParams:TUniStrings);override;

 

 

d2010 error:

[DCC Error] BMUniDbGrid.pas(93): E2003 Undeclared identifier: 'TUniStrings'

Share this post


Link to post
Share on other sites
Hi Csyasar, 
 
Tunistrings (I believe) is defined Uniguitypes.dcu also in Delphi10. 
 
Only for a test, 
Please copy UniguiTypes.dcu from ... \ FMsoft \ Framework \ unigui \ dcu \ delphi10 
 
in the directory where the package BMuniDBGrid.dpk is located. 
 
Build and install the package. 
 
Is working, you have a problem with delphi path: in Delphi see Tools.Options.Delphi Options.libary

 

Regards

 

Salvatore Marullo

Share this post


Link to post
Share on other sites

Hi,

 

I try to get it run without success. I've installed the TBMDBUniGrid without problems. I followed the pictures in the forum post to set up a button column. On Runtime, i can see the button column, thats fine. But if click on it, the OnButtonAction is never fired. I leave the OnActionColumnEvent property blank. maybe that is the problem?

 

Maybe a little demo program would help me.

 

Thanks in advance

Share this post


Link to post
Share on other sites

Hi Kiener , 

 

yes, this is the problem. 
 

at the moment  are busy . 

 

Later   I will post  you a demo. 

 

Regards. 

 

 

 

 

 

procedure TMainForm.gridButtonAction(Sender: TObject; ButtonEvent: string);
begin
   memo.Lines.Add('Clik :  ' +  ButtonEvent )  ;
end;

Share this post


Link to post
Share on other sites

Hi rullamore,

 

First i have to thank you for the quick demo. I studed it and saw... there is no difference to my project. Hmm... the only difference was, that my grid was on a TuniPanel. So i set the grid directly to the form and.. it works!

So i changed your demo project in that way. I placed a TuniPanel on the form and set the grid into it. Now, even the demo project did not fire the OnButtonAction event.

 

Seems to be an issue.

 

Regards.

Share this post


Link to post
Share on other sites

Hi Kiener,

 

I think I understand the problem. 
 
At the moment I do not know if it a (my)  component  problem or a Unigui Problem. 
 

I'll let you know as soon as possible.

 

 Regards 

Share this post


Link to post
Share on other sites
Hi ganzqgy, 

 

 
Not tested in Delphi XE2. 
 
Maybe you can help.
 
===============================
procedure TBMUniDBGrid.JSEventHandler(AEventName: String;
  AParams: TUniStrings);
  var
    Vals: String;
    ArrayOfIndex: TArray<String>;
    I: Integer;
    CurrentPos: TBookmark;
    
 
 
    var Ts : Tstrings ;  // New XE2
    x         : integer ;   // New XE2
 
begin
  inherited;
 
  if SameText (AEventName,FActionColumnEvent)  then begin
      if assigned(Self.OnButtonAction) then
      self.OnButtonAction(self,AParams.Values['Buttons']) ;
 
  end
  else  if SameText (AEventName,'SelectedRows') then begin
      try
        SelectedRows := strtoint(AParams.Values['RowsCount']);
      except
          SelectedRows := 0 ;
      end;
  end
 
  else if  sametext(AEventName,'selectionchange') then
  begin
    Self.FSelectionListObject.RawValueOfIndex := AParams.Values['ArrayOfIndex'];
    Vals := Self.FSelectionListObject.RawValueOfIndex;
 
    // Vals := Vals.Replace('[', '');
    // Vals := Vals.Replace(']', '');
 
    Vals :=   StringReplace( Vals, '[', '', [RfReplaceAll] );    // XE2
    Vals :=   StringReplace( Vals, ']', '', [RfReplaceAll] );    // XE2
 
   // ArrayOfIndex := Vals.Split([',']);
 
 // XE2 
    Ts := Tstringlist.Create ;
    ts.Delimiter := ',' ;
    ts.DelimitedText := Vals ;
 
   SetLength(ArrayOfIndex, ts.Count);           //   added by mr. ganzqgy  

 

 

 

    for x  := 0 to ts.Count- 1 do begin
 
      ArrayOfIndex[x] := ts.Strings[x] ;
    end;
    Ts.free 
  // XE2

 .......

........

 

 

 

Regards 

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

ts.CommaText  := Vals ;
    SetLength(ArrayOfIndex, ts.Count);
    for x  := 0 to ts.Count- 1 do begin
      ArrayOfIndex[x] := ts.Strings[x] ;
    end;
    ts.free ;

 

 

 

OK!Thanks

Share this post


Link to post
Share on other sites

×