1
procedure TfrmMain.memInfoMouseEnter(Sender: TObject);
begin
  if AktivArt then
  begin
    btnAddMemo.BringToFront;
    btnEditMemo.BringToFront;
  end;
end;

procedure TfrmMain.memInfoMouseLeave(Sender: TObject);
begin
  btnAddMemo.SendToBack;
  btnEditMemo.SendToBack;
end;

This works very well, but the problem is that when the mouse enter the buttons the they start to blink. Anyone who have a suggestion to solve this, or another way to get popup-buttons in a TMemo?

Sjubussen
  • 51
  • 1
  • 8
  • 4
    Rather then making the Button be a child of the Form and then moved above/below the Memo on the z-order, the button should be made a child of the Memo instead and then shown/hidden when needed. However, do be aware that when the mouse enters the Button, it leaves the Memo, thus the Button disappears, making the mouse re-enter the Memo and re-show the Button. That is why you get the flickering. You really should re-think your UI design – Remy Lebeau Dec 24 '22 at 08:38
  • they blink because you go to Memo MouseLeave when you go to the MouseEnter event of your Button. +1 for the UI problem – Bosshoss Dec 24 '22 at 11:12
  • 1
    How many of these were you planning on the form? I can see what you are trying to achieve. You could do it by looking at the mouse position and see if it's within the memo boundaries. It will be easier if you subclassed the memo and added the code in there. I am almost tempted to challenge myself. – Rohit Gupta Jan 10 '23 at 04:12
  • @RohitGupta i had planned at least 3 buttons. I went for a simple solution and put the buttons beside the memo. But i like the idea of popupbuttons or slideinbuttons so i will probably try this at a later stage. If you try, please keep us posted. – Sjubussen Jan 10 '23 at 08:34

0 Answers0