
In this section, I want to display the cover for each database in a scrollareagadget ResizeImage(PictureHandle.i, Program\CoverImageWidth, Program\CoverImageHeight, #PB_Image_Smooth) PictureHandle.i = CatchImage(#PB_Any, *PhotoBlobBuffer) *PhotoBlobBuffer = AllocateMemory(Picture_Length.i)īlobResult.i = GetDatabaseBlob(Program\DatabaseHandle, 0, *PhotoBlobBuffer, Picture_Length.i) Picture_Length.i = DatabaseColumnSize(Program\DatabaseHandle, 0) While NextDatabaseRow(Program\Databasehandle) If DatabaseQuery(Program\Databasehandle, DatabaseQuery.s) #False Extract the cover from the current database Program\DatabaseHandle = OpenDatabase(#PB_Any, Program\DatabaseName, #EmptyString, #EmptyString, #PB_Database_SQLite)ĭatabaseQuery.s + "SELECT * FROM Information WHERE Recordid = '1'" Procedure ListRecipeBooks(DirectoryToList.s, FileName.s)įileHandle.i = OpenFile(#PB_Any, DirectoryToList.s, FileName.s) Open each recipe book found and display the cover and description (Which is the filename) ListRecipeBooks(Program\DatabaseDirectory, FileName.s) SelectedFileType.s = LCase(GetExtensionPart(Program\DatabaseDirectory + FileName.s)) If TypeOfFile.i = #PB_DirectoryEntry_File TypeOfFile.i = DirectoryEntryType(DirId.i) Procedure FindRecipebooks(DirectoryToList.s)ĭirId.i = ExamineDirectory(#PB_Any, Program\DatabaseDirectory, "*.recipebook")ĬurrentFileEntry.i = NextDirectoryEntry(DirId.i) Program\DatabaseDirectory = Program\CurrentDirectory + "Recipebooks\" Program\CurrentDirectory = GetCurrentDirectory() ProcedureReturn WindowID(#Window_Recipebook)ĭeclare FindRecipebooks(DirectoryToList.s)ĭeclare ListRecipebooks(DirectoryToList.s) ImageGadget(#Gadget_Recipebook_Recipebook1, 10, 10, 112, 97, ImageID(#Image_Recipebook_Recipebook1)) SetGadgetColor(#Gadget_Recipebook_Availablebooks, #PB_Gadget_BackColor, $FFFFFF) ScrollAreaGadget(#Gadget_Recipebook_Availablebooks, 5, 5, 615, 605, 613, 700, 5, #PB_ScrollArea_Flat | #PB_ScrollArea_BorderLess) SetWindowColor(#Window_Recipebook,$FFFFFF) If OpenWindow(#Window_Recipebook, 72, 79, 624, 620, "Open another recipe book", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_Invisible) _OPT_Recipebook_Recipebook1: : IncludeBinary "Images\nopicture2.jpg" #ImageIndex = #PB_Compiler_EnumerationValueĬatchImage(#Image_Recipebook_Recipebook1, ?_OPT_Recipebook_Recipebook1) #GadgetIndex = #PB_Compiler_EnumerationValue #WindowIndex = #PB_Compiler_EnumerationValue Wanting to make it easier on them.Ĭode: Select all Image decoders used for Recipe book coversĭefine EventID, MenuID, GadgetID, WindowID P.S This was done to 'humanise' the database picking process as end users don't necessarily understand the terms 'database', have trouble with directories (and lots more).
PUREBASIC DISPLAY PICTURE FULL SCREEN CODE
(Damn!)īut see what you think of the code I did come up with just to get to that stage (before doing the display). I don't follow the math required to do the calculation for this sort of spacing across and down and I know I forgot the list for keeping track of the dynamically created image gadgets. If a cover does not exist for that database, a default will be shown in its place. The code below will list all database (Recipe books) in a preset directory, extract the recipe cover images from each one and then display them on a scrollareagadget, 5 covers across with each one having the filename as a comment below it and then the next line down if there are more covers. Now the blasted cat needs to go to the vet again. Sorry it's taken so long, still been coughing every day. RASHAD why do not you give us a snapshot to what you like
