Q&A - Question
PaintExtraEvent is not being triggered when Ctrl Key is pressed\down
Question
MicN asked on January 05, 2024, keyword: Developer Kernel
Hi there,
I need to draw a dotted rectangle on the map with the events Mouse click and drag with Ctrl Key is pressed\down.
Without the Ctrl Key is pressed\down, the dotted rectangle is being drawn on the map. The PaintExtraEvent
====
Codes
====
FMap: TGIS_ViewerWnd;
FMap.PaintExtraEvent := ttkPaintExtraEvent;
procedure TMapBase.ttkPaintExtraEvent(_sender: TObject; _renderer: TGIS_RendererAbstract; _mode: TGIS_DrawMode);
begin
// draw a selection rectangle
if (MapTool in [mtPupilInfo,mtStreetInfo,mtStudyClone])
and (FMouseDownPoint <> Point(-1,-1))
and (FMouseMovePoint <> Point(-1,-1))
and not SamePoint(FMouseDownPoint, FMouseMovePoint)
then begin
_renderer.CanvasPen .Style := TGIS_PenStyle.Dash;
_renderer.CanvasBrush.Style := TGIS_BrushStyle.Clear;
_renderer.CanvasDrawRectangle( Rect( FMouseDownPoint.X, FMouseDownPoint.Y, FMouseMovePoint.X, FMouseMovePoint.Y ) );
end;
end;
Is there a different event that need implemented?
Thanks,
Michael
Answers
Tomasz Kosinski (TatukGIS) replied January 05, 2024
Very strange. PaintExtra does not rely on any Key Code. My fast test does not show anything like this. Please send a minimised sample project to support@
MicN replied January 05, 2024
You are right. All good!
I was missing the conditions when Ctrl Key is down in the Mouse Move event that force the rectangle to be drawn.
Thanks for you response!
procedure TMapBoundary.ttkMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: integer);
var
ptg: TGis_Point;
begin
if FMap.IsEmpty then
exit;
if FMap.InPaint then
exit;
inherited;
if (
((MapTool in [mtPupilInfo]) and (Shift = [ssLeft]))
or
((MapTool = mtPupilInfo) and (Shift = [ssLeft, ssCtrl]))
) then
begin
FMap.Invalidate; // force selection rectangle to be drawn
If you would like to answer the question please Sign In.
Rules
The Questions and Answers (Q & A) is intended to provide a means of communication between TatukGIS customers.
- Licensed users (with active maintenance play) of TatukGIS products may contribute to the Q & A content. Read-only access is available to anyone.
- Keep the content positive and professional.
- Be courteous to others by posting information when a question or issue asked on the Q & A is answered or resolved by other means (such as with help from TatukGIS technical support). Offer others at least a hint how the posted question was answered or the issue was resolved.
- The Q & A is not a replacement for TatukGIS technical support. TatukGIS team may or may not regularly follow or contribute content.