Dismiss Notice

REGISTRATION IS AFTER ADMIN ACTIVATION

DONATIONS WITH PAYPAL CLICK TO BUTTON

1 MONTH VIP - 5$; 3 MONTHS VIP - 10$; 6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$

DONATIONS WITH Bitcoin Address:3NRs3CK3fhXifrNYxHEZKpETDd9vNLMsMD

Dismiss Notice
The registration is approved by the Administrator. It takes about 1 day to approve your registration
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

Laws
Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.
Donate Help To Us and Be VIP
DONATIONS WITH PAYPAL CLICK TO BUTTON
6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$
Social Block