Jump to content

Recommended Posts

Posted

Since there's no SelectedIndex property on TUniDBGrid, how to change active (selected) grid column (cell) in runtime ?

 

I tried to call ExtJS tweak:

 

UniSession.AddJS('Form.Grid.getView().focusCell(3,3)');

 

but without success (no error, no action).

 

Is there ANY solution how to control grid active column ?

 

(Active Row is DataSet Current Record).

 

Thanks a lot.

 

Posted

I didn't understand your question?

 

If your dbgrid connected to datasourse you may know the specific record by using the table properties.

Posted

Yes, the record is known. But i need to focus specific column (so to move grid cursor from one cell to another, within current record).

In VCL there is SelectedIndex property on grid for this purpose,

but in uniGUI I see no way...
 

Posted

You can create a inherited component, i.e. TUniExDBGrid = class( TUniDBGrid ); add one property "property Col: Integer read GetCol write SetCol;" and in implementation add below code:


  TUniExDBGrid = class( TUniDBGrid )

  private
    function  GetCol: Integer;
    procedure SetCol(Value: Integer);

  published
    property Col: Integer read GetCol write SetCol;
 
Implementation

function TUniExDBGrid.GetCol: Integer; 
begin 
  Result := CurrCol-1; {-1 for CurrCol} 
end; 

procedure TUniExDBGrid.SetCol(Value: Integer); 
begin 
  CurrCol:=Value+1; {+1 for CurrCol} 
end; 

 

It works for me, let me know whether it works for you or not.

  • Upvote 2
Posted

One more option is using Hack

 

unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,  Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses...
.
.
type THackGrid = class(TUniDBGrid);
type
  TMainForm = class(TUniForm)
    Grid1: TUniDBGrid;
.
.
  private
    { Private declarations }
  public
    { Public declarations }

implementation

procedure TMainForm.BitBtnmovecolClick(Sender: TObject);
begin
   THackGrid(Grid1).CurrCol :=  newindex ;  // Set the required columindex
end;

  • Upvote 1
  • 5 years later...
Posted

What an odd property (CurrCol) to be protected. Has anything changed in this respect in the past 5 years ?
I'm coming towards the end of my UniGUI evaluation - just the Grid to test and I'm finding it missing a lot of functionality compared to thge VCL grids I'm used to. Hopefully just the learning curve, rather than missing features.

  • Administrators
Posted

What an odd property (CurrCol) to be protected. Has anything changed in this respect in the past 5 years ?

I'm coming towards the end of my UniGUI evaluation - just the Grid to test and I'm finding it missing a lot of functionality compared to thge VCL grids I'm used to. Hopefully just the learning curve, rather than missing features.

 

Hi,

 

What are those functions that you have found missing?

If you are referring to standard VCL.TDBGrid, uniGUI already has a lot far more features compared with it.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...