Author |
Topic |
|
zerob
177 Posts |
Posted - Dec 07 2024 : 12:44:20
|
Hi Nigel
As i wanted to do ApplyChanges on a changed PDF page, after the page got turned, i found out, that i have to track the OnImageSeek event of the ImageEnView (for the click on the > icon in the ImageEnView) aswell as the OnSelectionChange of the linked ImageEnMView.
In both events i did a check for PageModified.
When i did turn the page through ImageEnMView, all was nice, but when the Seek event got fired by the click on the > icon, then both events got fired and no matter if the page got changed or not, the PageModified always was True.
I found the problem, as the OnMouseDown function always painted the image on the ImageEnView, even if i just clicked the > icon.
I found no way to check if the > icon got clicked or if the user meant to put the image there.
If the ImageEnView is big, the > icon is outside of the PDF size and i can filter the click position out, but if it is smaller and the > icon is inside of the PDF area, i found no way to check for the button click.
Is there a way to check where the > icon would be, to filter that area on a MouseDown event and is there a way to quickly check if the area clicked is the PDF or outside, or do i need to do a: PtInRect(Rect(0,0,ImageEnView1.PdfViewer.PageWidth,ImageEnView1.PdfViewer.PageHeight),clickPos.ToPoint); And if so, what happens if the user switches to continuous pages? Is it then outside of the PDF when a user scrolls halfway down and clicks on the half shown new page or if a full second page is shown, or partially scrolled, is the Y position then also not starting at 0?
I think checking for the page area would be needed by me in different projects, even when the > icon for seeking was solved. No need to react or paint some image if it would be hidden when placed outside of the PDF. |
|
xequte
38682 Posts |
Posted - Dec 08 2024 : 14:06:40
|
Hi
Please email me for the latest beta which includes an OnBeforeLoadImage event.
Nigel Xequte Software www.imageen.com
|
|
|
zerob
177 Posts |
Posted - Dec 08 2024 : 14:28:40
|
Does this Event or the Beta also solve the problem, that i don't add an image to the PDF when the user clicks on the ">" icon, as this also triggers the MouseDown in which i add a Image to the PDF and cause a PageChange? Also clicking outside of the PDF into the empty area triggers a MouseDown and adds the image outside the pdf area, as the click was outside. |
|
|
xequte
38682 Posts |
Posted - Dec 08 2024 : 16:14:06
|
Sorry, can you give me some precise steps to reproduce that?
Nigel Xequte Software www.imageen.com
|
|
|
zerob
177 Posts |
Posted - Dec 09 2024 : 01:24:09
|
If i load a PDF into a ImageEnView, a ">" navigation arrow icon appears either on the PDF area (if the ImageEnView is smaller than the PDF) or outside, if the PDF is centered, zoomed or smaller than the ImageEnView.
If i apply a Image to the PDF on mousedown event, this event also will be triggered when the user clicks either on the "<>" navigation seeking icons inside or outside of the PDF area, or even on the completely empty area, as the ImageEnView triggers mousedowns on its area, inside, outside of pdf or even inside of the arrow buttons "<>".
To stop this, if the click is outside i did a ptinrect check for the pagesize, but im not able to do this in certain things, for example if the "<>" navigation icons appear inside of the PDF...
This way when somebody clicks on these nav icons, my app still does put in the images and the page gets changed. And if the mousedown to navigate or on empty area outside of the PDF, then the image also gets added but hidden, as it is outside of the PDF (which im able to stop with my ptinrect check)
Can you make a way to see if the click was inside or outside of the PDF area and if the click /_ mousedown was inside or outside of the "<>" navigation seeking buttons?
So i won't trigger anything if the user just turned the pages? |
|
|
xequte
38682 Posts |
Posted - Dec 09 2024 : 16:29:48
|
Hi
Unfortunately your MouseDown event occurs before any processing of the buttons, so you would need to check yourself whether the click is within the boundaries of the button, e.g. using ImageEnView1.ButtonParams.FindButtonAt():
https://www.imageen.com/help/TIEButtonInteraction.FindButtonAt.html
But I personally do not believe buttons should be used in tandem with PDF editing functionality. You will need to work around many such issues (selection being another one).
Nigel Xequte Software www.imageen.com
|
|
|
zerob
177 Posts |
Posted - Dec 10 2024 : 07:09:44
|
Yes you're right, i just tried to deal with these Left/Right buttons as i assumed they are forced. I tried out different things but i wasn't able to hide the <> buttons on the PDF. Finally after more tests, i found out, that loading a PDF, overwrites the ImageEnView1.ShowButtons setting and adding the "iebtNext" to it.
I not only had the ShowButtons in the IDE empty, but also had to empty it after a: //ImageEnView1.IO.LoadFromFilePDF('.\demo.pdf'); ImageEnView1.PdfViewer.LoadFromFile('.\demo.pdf'); ImageEnView1.ShowButtons := []; |
|
|
zerob
177 Posts |
Posted - Dec 10 2024 : 14:09:25
|
I found something else. Setting the ShowButtons to [] in code, after the loading of the pdf, removes the Buttons, but as soon as i navigate with the ImageEnMView Thumbnails, the buttons reappear. |
|
|
xequte
38682 Posts |
|
|
Topic |
|
|
|