New call-to-action
Results 1 to 11 of 11

Thread: Creating an "Import image" button

  1. #1
    Inge Hansen
    Guest

    Default Creating an "Import image" button

    I'm trying to create a button for my form that opens up the "Import Image" dialog box (the one that appears when right-clicking an "jpeg image field" and then selecting "Import Image"), but I can't find any way of doing this?

    Can anyone help me?

  2. #2
    Former Alpha Employee JerryBrightbill's Avatar
    Real Name
    Jerry Brightbill
    Join Date
    Apr 2000
    Posts
    5,173

    Default RE: Creating an

    The function used by the Alpha image menu is a5_control_change_image(obj) where obj is apparently a pointer to the field that contains the image. However, it is an internal use function and is undocumented, so you would just have to experiment.

    Jerry

  3. #3
    "Certified" Alphaholic Scott Emerick's Avatar
    Real Name
    Scott Emerick
    Join Date
    Dec 2000
    Location
    Central Virginia/ North Carolina Border
    Posts
    2,154

    Default RE: Creating an

    Inge,

    To expand on Jerry's answer.

    Lets say the image field object name on your form is "Image1", the syntax would be:

    a5_control_change_image(parentform:Image1.this)

    Scott

  4. #4
    Inge Hansen
    Guest

    Default RE: Creating an

    Scott and Jerry,

    It's working perfectly. Thanks a lot guys!!!

    Inge

  5. #5
    Inge Hansen
    Guest

    Default RE: Creating an

    Uh oh...

    I think I was a little bit quick when I said it was working perfectly. When clicking on my button I get the same dialog box as if I do it the regular way (Right-clicking on the image => "Import" ). But, the trouble is that when I select the proper image and click "OK", it doesn't show in my form. It doesn' seem like it has been stored or anything.

  6. #6
    "Certified" Alphaholic Scott Emerick's Avatar
    Real Name
    Scott Emerick
    Join Date
    Dec 2000
    Location
    Central Virginia/ North Carolina Border
    Posts
    2,154

    Default RE: Creating an

    Inge,

    a5_control_change_image(parentform:Image1.this) does change the picture on the form for me. Here is another way that will give you a result.
    Try this:

    dim vfilename as c
    result = ui_get_image_filename()'This opens the Image dialog
    If result "> "" then "user pressed ok after selecting a picture
    vfilename = result 'Returns path and filename
    End If

    If you want to preset the directory the Image dialog opens in then use ui_get_image_filename("YOURPATH\YOURPICS")

    Hope this helps.

    Scott

  7. #7
    Inge Hansen
    Guest

    Default RE: Creating an

    Scott,

    No, I'm still not getting it right. Could it be that I've messed too much around the Modal/Modeless options?

    Inge

  8. #8
    Robert Lee
    Guest

    Default RE: Creating an

    Scott
    Could you be kind enough to post the whole script ? I tried but I get
    Invalid data type for this operation

    I only have 2 fields on this form, Name C 16 and Pic1 =JPEG

    Thanks

  9. #9
    "Certified" Alphaholic Scott Emerick's Avatar
    Real Name
    Scott Emerick
    Join Date
    Dec 2000
    Location
    Central Virginia/ North Carolina Border
    Posts
    2,154

    Default RE: Creating an

    Robert,

    There really wasn't a "Whole Script" to post ... I just did that as an example.

    Is Pic1 a Image File Reference Field or a jpeg image field?

    My example is for the Image File Reference Field only.

    If Pic1 is a jpeg image field then look at this link.
    Code from Selwyn

    If you have trouble understanding it I can help you, just email me directly.

    Scott

  10. #10
    Robert Lee
    Guest

    Default RE: Creating an

    Thanks Scott
    Name is the field name, type is C/16
    Pic1 is the field name, type is JPEG

  11. #11
    Inge Hansen
    Guest

    Default RE: Creating an

    I solved it using Matthews jpeg-solution. Thanks folks!

    Inge

Similar Threads

  1. ODBC Import error-"defined record is too long"
    By KeithW in forum Alpha Five Version 6
    Replies: 35
    Last Post: 11-27-2005, 05:11 PM
  2. Creating a Form "Header"
    By Howard G. Cornett in forum Web Application Server v6
    Replies: 7
    Last Post: 09-02-2004, 06:20 AM
  3. "Data form full" after *.dbf import.
    By Luc Verlee in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-21-2004, 04:15 AM
  4. Print Image file reference "IMAGE"
    By John Gamble in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-04-2004, 05:30 PM
  5. Help with "Image File Reference " Type F
    By Graham Wickens in forum Alpha Five Version 5
    Replies: 0
    Last Post: 05-01-2003, 08:27 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •