Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Change the grid cursor over a specific column
Mon, May 3 2021 3:23 PMPermanent Link

Sergei Safar

Hi!

I need to change the TGrid cursor from crDefault to crPointer when the mouse is over a specific column.

I could not find things like TGridCoord or TGrid.MouseCoord.

Any hint?

Regards,
Sergei Safar
Mon, May 3 2021 8:57 PMPermanent Link

Raul

Team Elevate Team Elevate

On 5/3/2021 3:23 PM, Sergei Safar wrote:
> I need to change the TGrid cursor from crDefault to crPointer when the mouse is over a specific column.
>
> I could not find things like TGridCoord or TGrid.MouseCoord.
>
> Any hint?

Check out CellUpdate event- this is called whenever cell is updated.
Cursor is think is on grid level so set it when over correct cell and
reset back when not

Raul
Tue, May 4 2021 4:49 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Sergei,

<< I need to change the TGrid cursor from crDefault to crPointer when the mouse is over a specific column. >>

If you only need to change the cursor for the column (and not the column header), then you can just add this property to the TGridColumn class in the WebGrids unit:

  TGridColumn = class(TBindableColumnControl)
     private
...
     published
        property Alignment: TContentAlignment read FAlignment write SetAlignment default caLeft
           description 'Specifies how to align the contents of the column';
        property AllowSize: Boolean read FAllowSize write SetAllowSize default True
           description 'Specifies whether the column can be resized or not';
        property AutoDropDown: Boolean read FAutoDropDown write SetAutoDropDown default False
           description 'Specifies that the drop-down control should automatically be shown '+
                       'for a combo control when the user starts typing';
        property CalendarDefaultView: TCalendarView read FCalendarDefaultView
                                                    write SetCalendarDefaultView default cvMonth
           description 'Specifies the default and minimum allowed calendar view for the drop-down calendar control';
        property CalendarWidth: Integer read FCalendarWidth write SetCalendarWidth default 0
           description 'Specifies the width of the drop-down calendar control';
        property CalendarHeight: Integer read FCalendarHeight write SetCalendarHeight default 0
           description 'Specifies the height of the drop-down calendar control';
        property ControlType: TGridColumnControlType read FControlType write SetControlType default ctNone
           description 'Specifies the type of control to use for displaying and/or editing the column';
        property Cursor;  <<<<<<<<<<<<<<<<<<<<<  Here !!!!
        property DataColumn;

Then, just rebuild the component library (or restart the IDE) and you should be able to change the cursor for the grid columns.

If that is satisfactory for you, please let me know and I'll include it in the next build.

Tim Young
Elevate Software
www.elevatesoft.com
Sun, May 9 2021 7:29 AMPermanent Link

Sergei Safar

Tim,

It worked perfectly.

Thank you.

Regards,

Sergei Safar

Tim Young [Elevate Software] wrote:

Sergei,

<< I need to change the TGrid cursor from crDefault to crPointer when the mouse is over a specific column. >>

If you only need to change the cursor for the column (and not the column header), then you can just add this property to the TGridColumn class in the WebGrids unit:

  TGridColumn = class(TBindableColumnControl)
     private
...
     published
        property Alignment: TContentAlignment read FAlignment write SetAlignment default caLeft
           description 'Specifies how to align the contents of the column';
        property AllowSize: Boolean read FAllowSize write SetAllowSize default True
           description 'Specifies whether the column can be resized or not';
        property AutoDropDown: Boolean read FAutoDropDown write SetAutoDropDown default False
           description 'Specifies that the drop-down control should automatically be shown '+
                       'for a combo control when the user starts typing';
        property CalendarDefaultView: TCalendarView read FCalendarDefaultView
                                                    write SetCalendarDefaultView default cvMonth
           description 'Specifies the default and minimum allowed calendar view for the drop-down calendar control';
        property CalendarWidth: Integer read FCalendarWidth write SetCalendarWidth default 0
           description 'Specifies the width of the drop-down calendar control';
        property CalendarHeight: Integer read FCalendarHeight write SetCalendarHeight default 0
           description 'Specifies the height of the drop-down calendar control';
        property ControlType: TGridColumnControlType read FControlType write SetControlType default ctNone
           description 'Specifies the type of control to use for displaying and/or editing the column';
        property Cursor;  <<<<<<<<<<<<<<<<<<<<<  Here !!!!
        property DataColumn;

Then, just rebuild the component library (or restart the IDE) and you should be able to change the cursor for the grid columns.

If that is satisfactory for you, please let me know and I'll include it in the next build.

Tim Young
Elevate Software
www.elevatesoft.com
Sun, May 9 2021 7:35 AMPermanent Link

Sergei Safar

Hi Raul,

thanks for the tip but take a look at Tim's solution.

Regards,
Sergei Safar

Raul wrote:

On 5/3/2021 3:23 PM, Sergei Safar wrote:
> I need to change the TGrid cursor from crDefault to crPointer when the mouse is over a specific column.
>
> I could not find things like TGridCoord or TGrid.MouseCoord.
>
> Any hint?

Check out CellUpdate event- this is called whenever cell is updated.
Cursor is think is on grid level so set it when over correct cell and
reset back when not

Raul
Image