Page 2 of 2
Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Wed Nov 27, 2024 10:43 pm
by HeX0R
With debugger enabled you see the problem:
[ERROR] ImagePickerGadget.pbi (Line: 301)
[ERROR] ResizeGadget(): Maximum supported gadget height is 32767 pixels
Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Wed Nov 27, 2024 11:00 pm
by le_magn
Hi, this is the list of all files in directory:
Name / Extension / Size / Date / Attributes
https://pastebin.com/DnCf0aES
Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Wed Nov 27, 2024 11:23 pm
by TI-994A
HeX0R wrote: Wed Nov 27, 2024 10:43 pm
With debugger enabled you see the problem:
[ERROR] ImagePickerGadget.pbi (Line: 301)
[ERROR] ResizeGadget(): Maximum supported gadget height is 32767 pixels
Thanks @HeXOR. That clearly needs a handler.
Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Wed Nov 27, 2024 11:38 pm
by TI-994A
Thank you for that. It appears to contain over 2000 JPG and PNG images. This could be the issue, as @HeXOR had pointed out, because the expected height of the canvas to display all the images
(even @120px height per image, double-columned) would exceed the 32767 canvas gadget height limitation.
I just tested the scenario myself, and the program crashed once the canvas size exceeded 32767.
But you mentioned that
the program did not crash for you? And that you are
still able to scroll upwards but not downwards past a quarter of the window?
Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Thu Nov 28, 2024 12:15 am
by TI-994A
Hi @le_magn. I've just posted an update which includes a fix that might circumvent the issue you're facing. It will now stop loading images once the canvas limitation is reached.
Barring any possibilities of implementing some form of lazy loading or paging, this would be a limitation of the gadget for now.
Please do give it a try and see if it works for you.
Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Thu Nov 28, 2024 12:43 am
by le_magn
TI-994A wrote: Thu Nov 28, 2024 12:15 am
Hi @le_magn. I've just posted an update which includes a fix that might circumvent the issue you're facing.
It will now stop loading images once the canvas limitation is reached.
Barring any possibilities of implementing some form of lazy loading or paging, this would be a limitation of the gadget for now.
Please do give it a try and see if it works for you.
yes i tried, a message popup display limit reached not all images loaded etc... but now scroll until the end and up ok
Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Thu Nov 28, 2024 6:57 am
by TI-994A
le_magn wrote: Thu Nov 28, 2024 12:43 amyes i tried, a message popup display limit reached not all images loaded etc... but now scroll until the end and up ok
Thanks for the confirmation, @le_magn. Glad to hear that.
I'm still working on some additional enhancements to the gadget, so please look out for updates.
Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Thu Nov 28, 2024 5:51 pm
by AZJIO
Code: Select all
picker(index)\images(imgCount)\imgNum = LoadImage(#PB_Any, picker(index)\imagesFolder + DirectoryEntryName(directory))
Code: Select all
[21:49:18] [WARNING] ImagePickerGadget.pbi (Line: 312)
[21:49:18] [WARNING] The specified file does not exist.
Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Thu Nov 28, 2024 6:20 pm
by TI-994A
AZJIO wrote: Thu Nov 28, 2024 5:51 pm
Code: Select all
picker(index)\images(imgCount)\imgNum = LoadImage(#PB_Any, picker(index)\imagesFolder + DirectoryEntryName(directory))
Code: Select all
[21:49:18] [WARNING] ImagePickerGadget.pbi (Line: 312)
[21:49:18] [WARNING] The specified file does not exist.
Hi @AZJIO. Thanks for reporting this.
Would you be able to debug and check what file is causing that error? Because it is returned by the
ExamineDirectory() routine from your input folder
This
LoadImage() statement is called within a conditional block that filters through only files with the allowable image extensions. So it could possibly be a corrupted image file.
Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Thu Nov 28, 2024 9:56 pm
by AZJIO
I added "\" and it worked for me. You need to check that the path ends with "\"
Code: Select all
Debug picker(index)\imagesFolder + "\" + DirectoryEntryName(directory)
picker(index)\images(imgCount)\imgNum = LoadImage(#PB_Any, picker(index)\imagesFolder + "\" + DirectoryEntryName(directory))
Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Fri Nov 29, 2024 9:59 am
by TI-994A
AZJIO wrote: Thu Nov 28, 2024 9:56 pm
I added "\" and it worked for me. You need to check that the path ends with "\"
Code: Select all
Debug picker(index)\imagesFolder + "\" + DirectoryEntryName(directory)
picker(index)\images(imgCount)\imgNum = LoadImage(#PB_Any, picker(index)\imagesFolder + "\" + DirectoryEntryName(directory))
Thanks @AZJIO.
I supposed that the accuracy of the folder name should be handled by the user. PureBasic's native functions, like get temporary and current directories, return the values with the trailing path separator.
Nevertheless, it's an absolutely possible oversight, so I've added a validation for that.
I'll be crediting you for this fix, btw.

Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Fri Nov 29, 2024 8:55 pm
by TI-994A
HeX0R wrote: Wed Nov 27, 2024 10:43 pm
With debugger enabled you see the problem:
[ERROR] ImagePickerGadget.pbi (Line: 301)
[ERROR] ResizeGadget(): Maximum supported gadget height is 32767 pixels
Hello again, @HeXOR. Thanks for reporting this bug. Please do note that I have credited you for this fix in the latest update.

Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Fri Nov 29, 2024 9:10 pm
by TI-994A
I've just posted another update to the
ImagePickerGadget(). This update changes some of the earlier parameter names, and adds some new ones, in addition to a few bug fixes.
Some of the new features include:
- support for images of different sizes and orientations
- auto-rotating preview window to display portrait & landscape images
- thumbnails with options to display borders, background, and titling
- titling derived from image file names, and sized in proportion to the thumbnail
- busy notification window when loading large number of images
I thank all of you who have assisted in the initial testing of this gadget, and hope to receive your continued support.

Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Sat Nov 30, 2024 7:56 am
by fromVB
Wow! You've outdone yourself TI-994A!
I've not used PB in a while now but I could have really used this tool a few years back.
I quickly tested in with the free demo version of PB and was surprised that it worked. Keep up the magnificent work.

Re: PureBasic ImagePickerGadget() - A Cross-Platform Solution
Posted: Sat Nov 30, 2024 3:51 pm
by TI-994A
fromVB wrote: Sat Nov 30, 2024 7:56 am
Wow! You've outdone yourself TI-994A!
I've not used PB in a while now but I could have really used this tool a few years back.
I quickly tested in with the free demo version of PB and was surprised that it worked. Keep up the magnificent work.
Hi @fromVB, and thank you for your kind words and feedback.
I'm glad that you find it useful, even if you may not be using it.
I just checked, and you're right;
it does work with the demo version of PureBasic. I didn't expect it to work, at least not on macOS, because there are some
CocoaMessage() API calls used.
That's another feature then, I suppose.
