Announcement

Collapse
No announcement yet.

Need help w FireFly - FireImage custom control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help w FireFly - FireImage custom control

    If anyone else has experience with FireFly and the FireImage control, would you be willing to share a small snippet of code that shows how to load an image?

    Or, how to load an image into a Picture control?

    I'm not able to decipher the very terse help file on those topics.

    Thanks!
    -John


  • #2
    Also, if anyone has a copy of the file: FireImageSQLiteningDemo.zip,
    authored by Jean-Pierre Leroy and posted in the PS forum around July 02, 2010, please send me a PM?

    Thanks,
    -John

    Comment


    • #3
      OK, a more general question:

      Is ANYbody still using Firefly?

      Thanks,
      -John

      Comment


      • #4
        i John, i still use it, I find it very usefu, but i dont have experience with fireimage.
        www.pluribasic.com

        Comment


        • #5
          FireImageSQLiteningDemo.zip

          Comment


          • #6
            Originally posted by John Montenigro View Post
            Is ANYbody still using Firefly?
            Every. Single. Day. But I've not used that particular control.
            Real programmers use a magnetized needle and a steady hand

            Comment


            • #7
              OK, so I'm taking the FireImage plunge and hope to report back some success next week. Thanks for the link Pierre. I wasn't able to connect to the PS site the other day, but that link went OK... Thanks.

              Brian and Bud, nice to know you're still using FF too. I may have more questions for you at a later time, if that'd be ok.

              Thanks, everyone!
              -John

              Comment


              • #8
                Hi John,

                I still use FireFly every day combined with VPE (Virtual Print Engine), SQLitening, LibXL and SQL Tools Pro.

                If you have any questions regarding the FireImage custom control do not hesitate.

                Regards,
                Jean-Pierre
                Jean-Pierre LEROY

                Comment


                • #9
                  Thanks, Jean-Pierre! I will be getting back to VPE soon, so I will certainly ask for your help as I hit obstacles.
                  Thanks,
                  -John

                  Comment


                  • #10
                    Following up...

                    I've been building my new program in FireFly, and have hit an obstacle that I'm sure is simple for anyone else to identify, but it's eluded me!

                    In the first version of my program, I successfully load images from FILES into a FireImage control.

                    First, declare global arrays such as

                    GLOBAL gsSymbol() as string
                    REDIM gsSymbol(x to y)


                    then, assign the filespec:
                    gsSymbol(1) = "..\IMAGES\Symbol_DO.jpg"

                    later, display the image:
                    sPictureName = gsSymbol(RecNo) & Chr$(0)
                    nLoadStyle = %FIREIMAGE_LOADFILE ' load from file
                    SendMessage HWND_FRMMAIN_FireImage1, %FIREIMAGE_SETIMAGENORMAL, nLoadStyle, StrPtr(sPictureName)


                    GREAT!
                    ...
                    BUT!

                    I really don't want to distribute the image files, so I'm trying to convert it to compile
                    the images as RCDATA, and at runtime, load the images from resources.

                    Initially, create the resources:

                    #RESOURCE RcData Symbol_DO, "..\IMAGES\Symbol_DO.jpg"

                    Then declare the UDT member as:
                    TYPE...
                    Symbol As String * %MAX_PATH


                    Later, assign the resource name into the UDT member:
                    gtSymData(1).Symbol = "Symbol_DO"


                    Finally, attempt to display the image:
                    sPictureName = RTrim$(gtSymData(RecNo).Symbol, Chr$(0)) & Chr$(0)
                    nLoadStyle = %FIREIMAGE_LOADRESOURCE ' load from RCDATA resource
                    SendMessage HWND_FRMMAIN_FireImage1, %FIREIMAGE_SETIMAGENORMAL, nLoadStyle, StrPtr(sPictureName) ' wot's wrong here? *********


                    But the image fails to display!

                    Can anyone spot what I'm doing incorrectly?

                    Thanks,
                    -John



                    Comment


                    • #11
                      Found it! I wasn't properly clearing spaces from the Symbol name (fixed-length string) ...

                      Fixed it with:
                      sPictureName = RTrim$(gtSymData(RecNo).Symbol, Any $Spc & Chr$(0)) & Chr$(0) ' AH! wasn't clearing SPC

                      -John

                      [ADDED: running the EXE in a separate folder, the images don't appear, so I must not have properly embedded them as resources... did some more testing, and suddenly it's working as expected - only one exe with embedded images showing w no external image files!
                      Happy dance! ]

                      Comment


                      • #12
                        If you define the member Symbol and sPictureName as STRINGZ * MAX_PATH, can you just make that
                        sPictureName = gtSymData(RecNo).Symbol

                        Comment


                        • #13
                          Originally posted by Jean-Pierre LEROY View Post
                          Hi John,

                          I still use FireFly every day combined with VPE (Virtual Print Engine), SQLitening, LibXL and SQL Tools Pro.

                          If you have any questions regarding the FireImage custom control do not hesitate.

                          Regards,
                          Jean-Pierre
                          LibXL is next on my list. I use SQL_Tools and VPE all the time. Does it come with PB specific include files?
                          Real programmers use a magnetized needle and a steady hand

                          Comment


                          • #14
                            Originally posted by Bud Durland View Post

                            LibXL is next on my list. I use SQL_Tools and VPE all the time. Does it come with PB specific include files?
                            Hi Bob,

                            Yes for LibXL they provide include files for PB.

                            Jean-Pierre LEROY

                            Comment


                            • #15
                              Seems that Paul runs compeltely away from PB, which is not good seen that Firefly was a commercial product.
                              A little bit tweaking here and there. Firefly was a very good product, it was worth to be continued.
                              Here is a Sample for the Fireimage Control from Jean-Pierre LEROY attached. FireImageDemo.zip

                              Code:
                              '----------------------------------------------------------------------------------------------
                              ' FireImageDemo.ffp - illustrates how to ...
                              '----------------------------------------------------------------------------------------------
                              ' 1. ... to load dynamically a new picture into the control (%FIREIMAGE_SETIMAGENORMAL message)
                              ' 2. ... to adjust the image to the various available styles (%FIREIMAGE_SETFITSTYLE message)
                              ' 3. ... resize a FireImage control proportionally to the size of the FORM (%WM_SIZE message)
                              ' 4. ... restrict window/form resize to specific values (%WM_GETMINMAXINFO message)
                              '----------------------------------------------------------------------------------------------
                              ' This project could be compiled with PowerBASIC Include files or José ROCA Includes files
                              '----------------------------------------------------------------------------------------------
                              
                              Global gFileName As String
                              
                              '--------------------------------------------------------------------------------
                              Function FORM1_WM_CREATE ( _
                              hWndForm As Dword, _ ' handle of Form
                              ByVal UserData As Long _ ' optional user defined Long value
                              ) As Long
                              
                              ' format
                              FF_ComboBox_AddString(HWND_FORM1_COMBO1, "Auto size" ) ' %FIREIMAGE_AUTOSIZE = 0 ' Autoadjusts the image to the width or height of the control
                              FF_ComboBox_AddString(HWND_FORM1_COMBO1, "Actual size" ) ' %FIREIMAGE_ACTUALSIZE = 1 ' Shows the image with its actual size
                              FF_ComboBox_AddString(HWND_FORM1_COMBO1, "Fit to width" ) ' %FIREIMAGE_FITTOWIDTH = 2 ' Adjusts the image to the width of the control
                              FF_ComboBox_AddString(HWND_FORM1_COMBO1, "Fit to height") ' %FIREIMAGE_FITTOHEIGHT = 3 ' Adjusts the image to the height of the control
                              FF_ComboBox_AddString(HWND_FORM1_COMBO1, "Stretch" ) ' %FIREIMAGE_STRETCH = 4 ' Adjusts the image to the height and width of the control
                              
                              ' default to "Auto size"
                              FF_ComboBox_SetCurSel(HWND_FORM1_COMBO1, 0)
                              
                              End Function
                              
                              '--------------------------------------------------------------------------------
                              Function FORM1_COMMAND1_BN_CLICKED ( _
                              ControlIndex As Long, _ ' index in Control Array
                              hWndForm As Dword, _ ' handle of Form
                              hWndControl As Dword, _ ' handle of Control
                              idButtonControl As Long _ ' identifier of button
                              ) As Long
                              
                              Local lPath As Asciiz * %MAX_PATH
                              
                              ' to retrieve the default folder for 'My Documents'
                              SHGetFolderPath(0, %CSIDL_MYPICTURES, 0, 0, lPath)
                              
                              ' to select a picture
                              If FF_OpenFileDialog(HWND_FORM1, "Choose an image", gFileName, lPath, _
                              "Pictures (*.jpg, *.bmp, *.ico, *.gif, *.wmf, *.png)|*.jpg;*.bmp;*.ico;*.gif;*.wmf;*.png", "*", %OFN_EXPLORER Or %OFN_ENABLESIZING Or %OFN_FILEMUSTEXIST Or %OFN_READONLY,%FALSE) Then
                              
                              ' only if a picture is selected
                              If gFileName <> "" Then
                              
                              '----------------------------------------------------------
                              ' 1. ... to load dynamically a new picture into the control
                              '----------------------------------------------------------
                              SendMessage HWND_FORM1_FIREIMAGE1, %FIREIMAGE_SETIMAGENORMAL, %FIREIMAGE_LOADFILE, StrPtr(gFileName)
                              
                              '-----------------------------------------------------------
                              ' 2. ... to adjust the image to the various available styles
                              '-----------------------------------------------------------
                              SendMessage HWND_FORM1_FIREIMAGE1, %FIREIMAGE_SETFITSTYLE, FF_ComboBox_GetCurSel( HWND_FORM1_COMBO1), %TRUE
                              
                              End If
                              
                              End If
                              
                              End Function
                              
                              '--------------------------------------------------------------------------------
                              Function FORM1_WM_SIZE ( _
                              hWndForm As Dword, _ ' handle of Form
                              fwSizeType As Long, _ ' type of resizing request
                              nWidth As Long, _ ' new width of client area
                              nHeight As Long _ ' new height of client area
                              ) As Long
                              '--------------------------------------------------------------------------------------------
                              ' 3. ... resize a FireImage control proportionally to the size of the FORM (%WM_SIZE message)
                              '--------------------------------------------------------------------------------------------
                              ' If the window has not been been minimized.
                              If fwSizeType <> %SIZE_MINIMIZED Then
                              
                              ' for the FireImageControl
                              FID_ResizeControlOfForm(hWndForm, GetDlgItem(hWndForm, IDC_FORM1_FIREIMAGE1), nWidth, nHeight)
                              
                              End If ' If fwSizeType <> %SIZE_MINIMIZED Then
                              
                              
                              End Function
                              
                              '--------------------------------------------------------------------------------
                              Function FORM1_COMBO1_CBN_SELCHANGE ( _
                              ControlIndex As Long, _ ' index in Control Array
                              hWndForm As Dword, _ ' handle of Form
                              hWndControl As Dword, _ ' handle of Control
                              idComboBox As Dword _ ' identifier of combobox
                              ) As Long
                              
                              ' only if a picture is selected
                              If gFileName <> "" Then
                              
                              '-----------------------------------------------------------
                              ' 2. ... to adjust the image to the various available styles
                              '-----------------------------------------------------------
                              SendMessage HWND_FORM1_FIREIMAGE1, %FIREIMAGE_SETFITSTYLE, FF_ComboBox_GetCurSel( HWND_FORM1_COMBO1), %TRUE
                              
                              End If
                              
                              End Function
                              
                              '--------------------------------------------------------------------------------
                              Function FORM1_CUSTOM ( _
                              hWndForm As Dword, _ ' handle of Form
                              wMsg As Long, _ ' type of message
                              wParam As Dword, _ ' first message parameter
                              lParam As Long _ ' second message parameter
                              ) As Long
                              
                              Local MinMaxPtr As MINMAXINFO Ptr
                              Static hPopupMenu As Dword
                              Local lSelectedRow As Long
                              
                              Select Case wMsg
                              
                              '----------------------------------------------------------------------------------
                              ' 4. ... restrict window/form resize to specific values (%WM_GETMINMAXINFO message)
                              '----------------------------------------------------------------------------------
                              Case %WM_GETMINMAXINFO
                              MinMaxPtr= lParam
                              
                              ' specify the minimum value for dialog resize
                              @MinMaxPtr.ptMinTrackSize.x= 200 ' width
                              @MinMaxPtr.ptMinTrackSize.y= 200 ' heigth
                              
                              End Select
                              
                              End Function
                              Attached Files
                              --Theo Gottwald
                              ------------------------------------------------
                              76706 Dettenheim * Germany * [email protected]
                              ------------------------------------------------
                              Joses Forum * Theo's Link Site * IT-Berater.org

                              Comment

                              Working...
                              X