I upgraded to Servoy 2024.3.3 LTS (to us the last smartVersion…)
I’ m using Openjava Version 21.02 and WIN 11
To import a picture in my table ‘titel’ I’m using this function:
function onBildHinzufuegen(event) {
// TODO Auto-generated method stub
if (foundset.cover_gross == null )
{ var _bild = plugins.file.showFileOpenDialog();
var image = plugins.images.getImage(_bild);
foundset.cover_gross = image;
foundset.cover_klein = image.resize(60,80);
}
else{
var theButton = plugins.dialogs.showQuestionDialog(‘Cover-Info’,‘Es ist schon ein Cover vorhanden, wollen Sie es überschreiben?’,‘OK’,‘NEIN’);
if (theButton == ‘OK’){
_bild = plugins.file.showFileOpenDialog();
image = plugins.images.getImage(_bild);
foundset.cover_gross = image;
foundset.cover_klein = image.resize(60,80);
}
}
}
Which worked perfectly with older Servoy versions…
Using this function in 2024.04 I have two problems:
a) the showFileOpenDialog
I am not able to move to the loctaion of my special pictures (F:\Eigene Dateien\Bilder\Zwischenlager\Zwischenlager_Fertig); it stops at F:\Eigene Dateien\Bilder and the screen freezes
If I move the directory to annother place outside directory “Bilder” - it works
Does WIN 11 read all files in the “Bilder”-directory (there are a lot…)???
and
Wenn I repeat this function I got the error "Cannot invoke “java.awt.Image…”
(maybe the function ist still waitung for collecting all information from the Bilder-directory? ???
The error about java.awt… is because there’s no check if the user doesn’t select a file.
Your next problem will be, what happens if the user selects a bmp or tiff or a defective file, because iirc. plugins.images only plays nice with png and jpeg.
And I moved the flow around a bit.
function onBildHinzufuegen(event) {
if (foundset.cover_gross != null) {
var theButton = plugins.dialogs.showQuestionDialog(
'Cover-Info',
'Es ist schon ein Cover vorhanden, wollen Sie es überschreiben?',
'OK',
'NEIN'
);
if (theButton != 'OK') {
return false;
}
}
var _bild = plugins.file.showFileOpenDialog();
if (_bild) {
var image = plugins.images.getImage(_bild);
if (image) {
foundset.cover_gross = image;
foundset.cover_klein = image.resize(60, 80);
}
}
}
I’d assume the problem with the files could be a problem with a new JDK, or if you access a flieshare on windows, you will generally have not much fun with more than 1000 Files in a folder. Does it work better when there are fewer files in the folder?
Hallo Robert,
thanks for digging in my code and makes it more suitable.
Still the same problem to move to the right directory (with some thousands of immages…
And right,
if I move the small target directory out of the Picture direktory to “C:” - no problem to open this directory and chhoce an image and of course storing the image…
I guess It’s a WIN 11 problem…