[Gambas-user] File select broken ?
Pino Zollo
pinozollo at ...626...
Thu Nov 19 16:22:52 CET 2009
I have just realized that my old code does not work any more in selecting .jpg
files.
Now I am using Gambas 2.17 but I do not know which release made it wrong.
Selecting the directory with my .jpg files it appears empty.
I have to select All Graphics .* to see them and then the selection works.
Here is a segment of the code.
Regards
Pino
-------------------------
' Filter for our user file open dialog. All image types supported by Gambas
PRIVATE FUNCTION FileFilter(OPTIONAL All AS Boolean = FALSE) AS String[]
DIM filter AS NEW String[]
IF All THEN
filter.Add("*.png *.jpeg *.jpg *.bmp *.gif *.xpm")
filter.Add("All Graphics")
END IF
filter.Add("*.png")
filter.Add("Portable Network Graphics")
filter.Add("*.jpeg *.jpg")
filter.Add("Joint Photographic Experts Group")
filter.Add("*.bmp")
filter.Add("Windows Bitmap")
filter.Add("*.gif")
filter.Add("Graphics Interchange Format")
filter.Add("*.xpm")
filter.Add("X PixMap")
IF All THEN
filter.Add("*")
filter.Add("All Files")
END IF
RETURN filter
END
PUBLIC SUB ToolButtonQSLa_Click()
DIM scale AS Float
Dialog.Filter = FileFilter(TRUE)
Dialog.Title = "Select the front side QSL image"
IF Dialog.OpenFile() THEN RETURN
PictureBoxQSLa.Picture = Picture.Load(Dialog.Path)
PictureBoxQSLa.Resize(PictureBoxQSLa.Picture.Width,
PictureBoxQSLa.Picture.Height)
img = Image.Load(Dialog.Path)
qsl_afile = Dialog.Path
tempFile = User.Home &/ "thumb.png" ' PostgreSQL has no rights to read
in Temp()
IF img.Width > thumbSize OR img.Height > thumbSize THEN '----- Calc
factor to scale isotropic
scale = Min(ThumbSize / img.Width, ThumbSize / img.Height)
img = img.Stretch(img.Width * scale, img.Height * scale, TRUE)
END IF
img.Save(tempFile)
EXEC ["chmod", "666", tempFile] WAIT ' give rights to PostgreSQL
PictureBoxThumb.Picture = Picture.Load(tempFile)
CATCH
Message.Warning("Error loading image:\n\n" & ERROR.Text)
END
----------------------------
--
Key ID: 0xF6768208
Key fingerprint = B16D 0A7C 5B29 A334 CE6A 71F6 EAF8 3D88 F676 8208
Key server: hkp://wwwkeys.eu.pgp.net
More information about the User
mailing list