Forum > RichMemo

OnMouseDown event

(1/18) > >>

RichMemo has an event for OnMouseDown ...

procedure TCmdForm.MemoMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

But it doesn't allow ... var Handled: Boolean;

It seems like it should.



--- Quote from: RW1962 on January 16, 2024, 11:57:27 am ---Rick
--- End quote ---
Welcome to forum Rick!

--- Quote from: RW1962 on January 16, 2024, 11:57:27 am ---It seems like it should.
--- End quote ---
Why you think that it seems to be missing?
It would be great if you add examples where it be needed, without not working etc...

The mouse triggers a Windows event, just like the keyboard will. If it had the HANDLED function then the Windows System would be told to ignore the mouse message. Moreover, that is how OnMouseWheel operates. It keeps from having crossed wires with the Windows System.


Again, please add an example where HANDLED for a mouse-event is badly needed.
Just imagine it exists, so I do understand for what you are needing such.
I do usual "exit" that event whenever I want so there is no need for such.

With this example mbExtra1 & mbExtra2 do not post the showmessage notice. This means that it does not process the function. However, mbRight does process ... my pop-up appears.

Nevertheless, the mouse button does activate the Windows System ... it does the PageUp & PageDown. This makes me think that Windows is overriding and suppressing my OnMouseDown operation.

It has also been sporadic. Sometimes the showmessage will post, and sometimes it won't do a PageUp or PageDown at all ... and no message.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TCmdForm.btnPgBckClick(Sender: TObject);begin  with PageMemo do       try         Screen.Cursor:= crHourGlass;         PageMemo.SetFocus;  // must set focus         KeyInput.Press(VK_PRIOR);   // must be capital 'A' for 'a'         KeyInput.Up(VK_PRIOR);        finally         PageMemo.SetFocus;         ReportPosition;         PrepareToolbar;         Screen.Cursor:= crDefault;       end;end; procedure TCmdForm.btnPgNxtClick(Sender: TObject);var hit: longint;begin  with PageMemo do       try         Screen.Cursor:= crHourGlass;         hit:= PageMemo.SelStart;   // prep to work-around for being hung on a graphic         PageMemo.SetFocus;     // must set focus         KeyInput.Press(VK_NEXT);   // must be capital 'A' for 'a'         KeyInput.Up(VK_NEXT);          if hit=PageMemo.SelStart then  // work-around for being hung on a graphic            begin            PageMemo.SelStart:= PageMemo.SelStart+1;            PageMemo.SetFocus;     // must set focus            KeyInput.Press(VK_NEXT);            KeyInput.Up(VK_NEXT);  // added            PageMemo.SelStart:= PageMemo.SelStart-1;  // *** maybe not ***            end;          finally         PageMemo.SetFocus;         ReportPosition;         PrepareToolbar;         Screen.Cursor:= crDefault;       end;end; // * CALLING ONMOUSEDOWN *procedure TCmdForm.MemoMouseDown(Sender: TObject; Button: TMouseButton;                                                          Shift: TShiftState; X, Y: Integer);var TempRTF: TRichMemo;    MemoSet: boolean;begin  MemoSet:= false;   // assign active editor to TempRTF  if (PageMemoOn) and (not PagePassive) then // global editor flags     begin     TempRTF:= PageMemo;     MemoSet:= true;     end;  if SearchBoxOn then // global editor flag     begin     TempRTF:= SearchBox;     MemoSet:= true;     end;  if ReplaceBoxOn then // global editor flag     begin     TempRTF:= ReplaceBox;     MemoSet:= true;     end;   if MemoSet then     begin     if not ((ssCtrl in Shift) or             (ssShift in Shift) or             (ssAlt in Shift)) then              begin              case Button of  // mbLeft, mbRight, mbMiddle, mbExtra1, mbExtra2                   mbRight: PopMenu.PopUp; // load popup menu  * IT WORKS *                   mbExtra1: begin                             showmessage('BACK'); // * NOTICE DOES NOT SHOW *                             btnPgBckClick(Self);                             end;                   mbExtra2: begin                             showmessage('NEXT'); // * NOTICE DOES NOT SHOW *                             btnPgNxtClick(Self);                             end;                   end; // end case              end; // end if not     end;  // if MemoSetend;  


[0] Message Index

[#] Next page

Go to full version