Forum > General
Quesion about TATImageBox
stab:
Hi,
I'm trying learn how to use TATImageBox. Zooming and panning works great. Would like to be able to use MouseDown event, but my program doesn't enter my code even though I've assigned it.
Seem to me that the event is somehow disabled.
How could one enable it? %)
stab:
following is excerpt from the lfm-code:
--- 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";}};} --- if (bitmap2 = nil) or (not chkgColorRects.Checked[0]) then object ATImageBox1: TATImageBox Left = 392 Height = 415 Top = 0 Width = 432 HorzScrollBar.Tracking = True VertScrollBar.Tracking = True Align = alClient AutoScroll = False BorderStyle = bsNone ClientHeight = 415 ClientWidth = 432 Color = clMedGray ParentColor = False PopupMenu = PopupMenu1 TabOrder = 0 OnClick = ATImageBox1Click OnMouseDown = ATImageBox1MouseDown OnMouseMove = ATImageBox1MouseMove OptFitToWindow = True OptDrag = False end
and following corresponding code:
--- 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 TfrmExtractElevationCurves.ATImageBox1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);var p : pBGRAPixel;begin if (bitmap2 = nil) or (not chkgColorRects.Checked[0]) then Exit; p := bitmap2.ScanLine[y]; Inc(p, x); AddColorRect(p^); DrawColorRects;end;
Have put a breakpoint at:
if (bitmap2 = nil) or (not chkgColorRects.Checked[0]) then
which is never hit
[Fixed code tags; please read How to use the Forum.]
jamie:
Look here..
https://github.com/Alexey-T/ATViewer/blob/master/Source/ATImageBox.pas
Study the source code.
The image is overlaying the ImageBox, there for your mouse messages are being sent to the image instead.
Maybe you can make some alterations of the source code to fix your needs if you really need to use that.
Me, I would simply piece some code together so I could get better control over it.
TScrollBox and Timage most likely will do as you need.
stab:
Thanks alot, should have thought about that myself. Have to figure out, how to mediate the message. :)
AlexTP:
It was easy to fix. Fixed. https://github.com/alexey-T/atimagebox-lazarus
Navigation
[0] Message Index
[#] Next page