FireImageSQLiteningDemo - FireImage control with SQLitening DataBase

Started by Jean-pierre Leroy, December 11, 2009, 06:10:37 PM

Previous topic - Next topic

Jean-pierre Leroy

Dear FireFly users,

I'm am happy to share with you a sample FireFly project that illustrates some aspects of the FireImage control combine with SQLitening; this project FireImageSQLiteningDemo version 1.02 illustrates how to ...

1. ... create a SQLite DataBase
2. ... save a picture in a BLOB field in the SQLite database
3. ... load dynamically a new picture from a file   into the control (%FIREIMAGE_SETIMAGENORMAL message with %FIREIMAGE_LOADFILE  )
4. ... load dynamically a new picture from a string into the control (%FIREIMAGE_SETIMAGENORMAL message with %FIREIMAGE_LOADSTRING)
5. ... adjust the image to the various available styles (%FIREIMAGE_SETFITSTYLE message)
6. ... sort a ListView (LVN_COLUMNCLICK notification)
7. ... draw a down-arrow (or up-arrow) on the columns header to indicate that information in the ListView is sorted in descending order (ascending order)
8. ... display a specific menu when the end-user click on the right mousse button over a ListView control (%WM_CONTEXTMENU & %WM_COMMAND messages)
9. ... extract the date and time a picture was taken (thanks to Jose) and store this information in the Database
10. ... resize dynamically all the controls (thanks to Paul for these new functionalities since FireFly 3.07)
11. ... display the selected picture when the user double-click a row in the ListView (%NM_DBLCLK message inside the %WM_NOTIFY message handler)
12. ... use the FF_OpenFileDialog() FireFly function
13. ... use the FF_SaveFileDialog() FireFly function
14. ... save the location and size of a FORM; function SaveLocationAndSize() inside the WM_DESTROY message handler *** NEW 07/02/2010 ***
15. ... restore the location and size of a FORM; function GetLocationAndSize() processes by the %WM_LOCATIONANDSIZE user message (WM_CUSTOM handler); thanks to Brian *** NEW 07/02/2010 ***


Notes:
   1. This project has to be compiled with Jose ROCA Includes files
   2. Most of the snippets in this project come from Paul and/or other PB users; I just try to put everything together on a sample project.
   3. This demo is not complete but could help some FF users to start with the FireImage control and a SQLite DataBase.
   4. The module Module1.inc contains some specific functions that are necessary to compile this project; usually these functions are part of my own Functions Library; to avoid any conflict I use a prefix JPL_ for these functions in this project.

Your feedback is welcome
Jean-Pierre

David Kenny


Paul Squires

Very cool Jean-Pierre! Great job. Thanks for sharing!


(Oh, you may want to distribute the sqlitening.inc file with your project as well).

Paul Squires
PlanetSquires Software

Jean-pierre Leroy

David, Paul; thank you for your messages; I hope this project could help some FF users to start using a SQLitening DataBase with BLOB fields that contain pictures (jpg files).

Paul; I followed your advice; I have just uploaded a new version that contains the SQLitening.inc as a module of the project.

Paul with the sample database included in this project 3 pictures out of 4 can be displayed correctly with the option %FIREIMAGE_LOADSTRING; only the picture "Collines.jpg" cannot be displayed; so my question is why it works with some pictures and not with others? any chance to have a fix in the upcoming 3.05 version for this odd issue?

Regarding this issue with the picture "Collines.jpg" I would like to know if other users have the same issue as me; please can you report in this thread if you have the same behavior with your PC; thank you.

Jean-Pierre

Andrew Lindsay

Jean-Pierre,

I can get all the pictures to load with the LOADFILE button, but when I press the LOADSTRING button, at best I get a 'tear' of the picture (a partial flash of the file on screen) then a blank canvas.

Best regards

Andrew

Jean-pierre Leroy

Hi Andrew, Thanks for reporting your tests on this thread; which system are you using ?

Jean-Pierre

Andrew Lindsay

Jean-Pierre,

I am using Windows 7 on an HP 8510P notebook, compiled with 3.04.

Regards

Andrew

Marc van Cauwenberghe


Rolf Brandt

Hello Jean-Pierre,

Quoteonly the picture "Collines.jpg" cannot be displayed with the option %FIREIMAGE_LOADSTRING; I would happy if other users can tell me if they have the same behavior on their PCs.

I have exactly the same behavior on my XP Pro SP3 machine. Also some of my own Jpegs won't show with LoadString.

Rolf
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Pat Dooley

Yes, "Collines" would not display.
I used SQLiteExpertPro to view and then export the jpg's from the db3. Then I used IRFanView to examine the Image  Information for each file. The only difference was that "Collines" had a DPI setting of 300. All the rest had a DPI setting of 96. Usng IRFanView, I changed the DPI setting to 96 and saved it under a different name. It loaded and displayed fine in the Fire Image Demo.
I don't know why DPI would make such a difference.
Pat

Jean-pierre Leroy

Pat, thank you for reporting what you have found with the DPI value; in the meantime Paul changed the FireImage control due to other issues with Windows 7; more information on this thread http://www.planetsquires.com/protect/forum/index.php?topic=2295.msg17932#msg17932

Now with the fixed version of the FireImage control, all the pictures are displayed correctly with either options i.e. LOADFILE (%FIREIMAGE_LOADFILE) and LOADSTRING (%FIREIMAGE_LOADSTRING).

Paul, I have nevertheless a small issue with the new version of the FireImage control; at least on my PC the temporary disk files are not deleted when I quit my application; see the screenshot.

Jean-Pierre.

Paul Squires

Thanks Jean-Pierre, I will double check the logic that deletes the temp files.
Paul Squires
PlanetSquires Software

Jean-pierre Leroy

Dear FireFly users,

I've just updated the FireImageSQLiteningDemo (FF Project available at the beginning of the thread) to show how to :

9. ... extract the date and time a picture was taken (thanks to Jose) and store this information in the Database
10. ... resize dynamically all the controls (thanks to Paul for these new functionalities since FireFly 3.07)
11. ... display the selected picture when the user double-click a row in the ListView (%NM_DBLCLK message inside the %WM_NOTIFY message handler)
12. ... use the FF_OpenFileDialog() FireFly function
13. ... use the FF_SaveFileDialog() FireFly function

Any question, do not hesitate to ask.

Your feedback is welcome.
Jean-Pierre

Jean-pierre Leroy

Dear FireFly users,

I've just updated the FireImageSQLiteningDemo to version 1.02 (FF Project available at the beginning of the thread) to show how to :

14. ... save the location and size of a FORM; function SaveLocationAndSize() inside the WM_DESTROY message handler
15. ... restore the location and size of a FORM; function GetLocationAndSize() processes by the %WM_LOCATIONANDSIZE user message (WM_CUSTOM handler); thanks to Brian


Any question, do not hesitate to ask.

Your feedback is welcome.
Jean-Pierre