QLPreviewViewMBS and Invalidate

I’m trying to use QLPreviewViewControlMBS to display the content of various files. It works well but seems to impact the ability of the rest of the window to respond to Invalidate requests.

Prior to viewing a file - I have QLPreviewViewControlMBS.visible set to false. In this state invalidate seems to work correctly with all items on the window.

To display a file I set QLPreviewViewControlMBS.visible set to true and point it at the file. The content of the file is now shown correctly but the rest of the window no longer responds to invalidates - or even hard refresh. The only thing that seems to set the window to its correct settings is to move the window to a different screen.

One complicating factor is that the QLPreviewViewControlMBS is located on in a container control whose visibility is set by a control - several may be on the window but only one is visible at a time. Similar to a tab panel - but the QLPreviewViewCOntrolMBS’s do not sit within a tab panel, they are just visible or invisible container controls.

Any thoughts as to how I can fix this?

Could you not just grab the Quicklook Preview from a file and shove it into a canvas?

Sam - I was originally using a combination of MoviePlayer and ImageWell for displaying the content of files - but Quicklook offered so much more (movies, scrolling through documents etc) - so I’d like to get that working if possible.

Sometimes Xojo is like visiting the Dr - he prescribes one drug then another drug to counter the side effects of the first one.

Check out QuickLookMTMBS. This is multi-threaded and works fine for a Canvas.

You cam still use QuickLook API, but instead of using a custom control to display the preview, it can give you an image that you can then draw into a canvas.

I use this technique to show file previews and also for an internal tool of mine that displays file meta data.

If you’re unsure I’ll post a code snippet tomorrow and you should be able to match up the MBS functions.

Thanks Beatrix & Sam. I’ll try a work-around - using QuicklookMTMBS to grab images and then, if user wants, putting into a QLPreviewPanel or QLPreviewViewControl in a separate within. Will let you know again if need help - but threading might well have been the problem.

The function you’re looking for is QLThumbnailImageCreate it creates a CGImage, which I am sure that MBS has a way to convert these to Xojo pictures.

QLThumbnailImageCreate is what QuicklookMBS and QuicklookMTMBS call internally.