1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Get mouseclick event when on disabled control

Discussion in 'Delphi Programming' started by aikona, Jun 6, 2014.

  1. aikona
    Offline

    aikona DF Member

    Hi

    I use a gridpanel filled with about 80 spinedit controls
    According to a schedule some of these spinedits are disabled and enabled at a later stage.

    Now the problem : If a spinedit is disabled the user has to be able to enable this.(in case of emergency)
    The preferred ways would be to use the right mouse button .... but the event is not fired because the control is disabled. ( catch 22)

    One workaround is to : change to 'ReadOnly' and 'No Tabstop' and 'ChangeColor to GreyedOut' but that still leave the window popupmenu getting called ( you know the one that enables you to copy and paste)

    Second workaround is to catch the mouse click in the gridpanel,but how do you identify the spinedit in that column/row

    Eric
     
  2. mrmarman
    Offline

    mrmarman DF Member

    Hi.

    If you disabled a control, mouse click(s) passed to the disabled items owner. 

    I think, this code will help you.


    Code:
    procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    Var
      Pos : TPoint;
    begin
      if Button = mbRight then
      begin
        Pos.X := X;
        Pos.Y := Y;
        if  ( ControlAtPos( Pos, True, True, True ) is TSpinEdit )
        AND ( NOT TSpinEdit( ControlAtPos( Pos, True, True, True ) ).Enabled )
          then TSpinEdit( ControlAtPos( Pos, True, True, True ) ).Enabled := True;
      end;
    end;
    
     
  3. aikona
    Offline

    aikona DF Member

    Thanks

    Will try this as soon as I can and give you feedback
     
  4. aikona
    Offline

    aikona DF Member

    Ok I had to add the 'control' name infront of ControlAtPos

    My spinedits are imbedded in a gridpanel

    Code:
     if  ( GRIDPANELNAME.ControlAtPos( Pos, True, True, True ) is TSpinEdit )
       AND ( NOT TSpinEdit(  GRIDPANELNAME.ControlAtPos( Pos, True, True, True ) ).Enabled )
         then TSpinEdit(  GRIDPANELNAME.ControlAtPos( Pos, True, True, True ) ).Enabled := True;
    

    Works well
     
  5. Prof_Ho2
    Offline

    Prof_Ho2 DF Member

    Good example

     
     
  6. adisaks
    Offline

    adisaks DF Member

    thank you.
     

Share This Page