delphi - How to display hint for a disabled control? -


i have check box enabled/disabled @ run time. want show different tool tips if enabled/disabled. thinking overriding onmouseenter event , handle there onmouseenter called if control enabled. how can possible achieve behavior? appreciated.

i tried handle onmousemove of form , this

procedure tdlg.pnltopmousemove(sender: tobject;shift: tshiftstate; x, y: integer); var   point: tpoint;   checkboxcursorpos: tpoint; begin   inherited;   point.x := x;   point.y := y;   checkboxcursorpos := chkbx.screentoclient(point);   if (ptinrect(chkbx.clientrect, checkboxcursorpos))   begin     if(chkbx.enabled)       chkbx.hint := 'enabled'     else       chkbx.hint := 'disabled' ;      application.showhint := true;   end;  end; 

but condition ptinrect not satisfied. doing wrong?

there simple solution: place empty tlabel on checkbox , set hint value disabled checkbox state. label has autosize off , can enforce position , size boundsrect property set of checkbox.

when checkbox enabled hint of checkbox used, while hint of label used when checkbox disabled.

update: saw bummi mentions similar idea in comment.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -