Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

showing a photo

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

    showing a photo

    I have a database listing stamps and I would like to include a button that I click to view the stamp described in a particular record and thought that if I named the files with the same number as the record ID generated automatically, I could then have it search for the photo (file) based on the ID number.

    Can anyone tell me how to make the ID number appear automatically for the current record that I am viewing, so that the correct photo would illustrate the record?

    Thank you.

    Sincerely,
    Rich

    #2
    RE: showing a photo

    Do you have a number somewhere in the table that represents te file name of the picture?? We have a similar situation with our employee and customer photos.

    Below is the code we use to display a dialog box with our customer's photo. The photos are stored using the customer's case number as .bmp files in a folder called "IMAGES". the variable "aa.bcbss.path" defines our main data path on the server.

    Hope this helps.

    'Date Created: 14-Jan-2003 12:36:56 PM
    'Last Updated: 24-Jul-2003 03:38:29 PM
    'Created By :
    'Updated By :
    dim aa as P
    aa= addin.variables()
    varinit()
    dim aa.bcbss as P
    'debug(1)
    dim shared access as N
    dim global oldfile as C
    tbl = table.current()

    if tbl.mode_get() " 0 then
    parent.commit()
    else
    dim pict1 as C
    if .not.exist(client-"SSN,"image.dbf","ssn") then
    'if .not.exist(client-"SSN,aa.bcbss.path+"\casereg\image.dbf","ssn") then
    ui_msg_box(trim(aa.bcbss.agency)+" Client Information System","No Image Record exists for this Client")
    end
    end if
    name1 = upper(trim(client-"fname)+" "+trim(client-"lname))
    'pict1 = lookupc("F",client-"SSN,"image",aa.bcbss.path+"\casereg\image.dbf","ssn")
    pict1 = lookupc("F",client-"SSN,"image","image.dbf","ssn")
    oldfile = aa.bcbss.path+"\IMAGES"+chr(92)+trim(pict1)+".bmp"
    if .not. file.exists(oldfile)
    ui_msg_box(trim(aa.bcbss.agency)+" - Error!","No Photo Exists for "+name1)
    end
    end if


    'new code for xdialog inserted here
    f = file.open(oldfile,FILE_RO_SHARED)
    ui_bitmap_load("temp",f.readb(10000000))
    f.close()
    ui_dlg_box(name1,""%dlg%
    {lf};
    {image=temp};
    {lf};
    "*15&Close"
    %dlg%)
    ui_bitmap_drop("temp")
    end if

    end


    Tom

    Comment


      #3
      RE: showing a photo

      Hello,
      Thank you very much for your response.

      I have the photos that I wish to have available for each record in a file, with the file name being the same number as the automatically generated ID number for each record.

      Also, I have a button set up that will allow me to look at the photo that I select.

      My problem is not the code to make it work, it already works ok, its just that in order to view a photo, I have to go into the design mode and change the file name (ID number) in order to view a different photo.

      What I need is a way to make the ID number of the CURRENT record appear in the place in the code where the photo file name appears. Example: Currently I have code for the ON PRESS go to c:/51.jpg. This system works just fine, except that I need the "c:/51.jpg" to be c:/xxx.jpg where xxx is a variable with the value of the current ID number inserted.

      I have the feeling that I am looking at something quite simple, but that I just can't quite grab ahold of it.

      Thanks again,

      Rich

      Comment


        #4
        RE: showing a photo

        Rich,
        The code dynamically links the appropriate file name to the record see below:

        ****** This is where I assign the file name of the proper image file ***************
        oldfile = aa.bcbss.path+"\IMAGES"+chr(92)+trim(pict1)+".bmp"
        if .not. file.exists(oldfile)
        ui_msg_box(trim(aa.bcbss.agency)+" - Error!","No Photo Exists for "+name1)
        end
        end if


        'new code for xdialog inserted here

        **** This is where I open the appropriate photo file ****
        f = file.open(oldfile,FILE_RO_SHARED)

        Tom

        Comment


          #5
          RE: showing a photo

          Rich,

          Sorry, I left out the little line that does the dynamic link to the file name

          pict1 = lookupc("F",client-"SSN,"image","image.dbf","ssn")
          oldfile = aa.bcbss.path+"\IMAGES"+chr(92)+trim(pict1)+".bmp"

          In the table "image.dbf", is a field called "image". This is the name of the file to display.

          "oldfile" is a fully qualified path to the image file.
          ie: \\percy\a5share\casereg\images\C012345.bmp


          This name will change depending on the value of the fierld "image".

          Tom

          Comment


            #6
            RE: showing a photo

            Thanks again for your response.

            I have no trouble linking to button to the file photo. What I dont know how to do is make the field photo number = the ID number.

            When I click the button on record # 51 (I have the action set to go to file # 51) up pops photo # 51. Wowzer... works perfectly. Whowever when I go to record #52 and press the button I get photo # 51.

            I have set up the following 2 actions ( don't know what any of it means, but it works)

            I"actions"[1]"display="""
            "sub_action_name="""
            "action_comment="Get 'Value' property of 'File_name'in Form 'Input' .""
            "action="Set variable(s) to field values - fields on a form""
            "bitmap="a5_set_variable""
            "has_condition=.F."
            "same_as_previous=.F."
            "condition_type_index=1"
            "condition_flag="""
            "condition_expression="""
            "parameter_string=""%str%
            "parameter_array"[1]"name="layout_code""
            "type="n""
            "comment="1=Current form, 2=Another form/browse""
            "value=1"
            "
            "[2]"name="form_window_name""
            "type="c""
            "comment="form window alias""
            "value="Input""
            "
            "[3]"name="ext_object_names""
            "type="c""
            "comment="external object names""
            "value=""ExtObjList"[1]"name=\"File_name|$a5_control_field\""\cr\lf"pArray"[1]"pName=\"value|a5_type_character\""\cr\lf"option_index=1"\cr\lf"value =\"\""\cr\lf"expression =\"\""\cr\lf"var_value =\"\""\cr\lf"variable_to_create=\"illustration\""\cr\lf"variable_to_create_scope=\"Shared\""\cr\lf"\cr\lf"\cr\lf"\cr\lf"\cr\lf""
            "
            "
            %str%"
            "flag_variables="""
            "script_variables=""%str%
            illustration|character
            %str%"
            "edit_with="xg1_obj_get_value""
            "generate_with="xg2_obj_get_value""
            "xbasic_code=""%str%
            'Get 'Value' property of 'File_name' in Form 'Input' .
            DIM SHARED illustration AS c
            illustration = topparent:File_name.value%str%"
            "post_process_code="""
            "help_topic="Set Variable(s) to Field Values (Fields on a Form)|1""
            "action_name="{I:'a5_set_variable'} Set variable(s) to field values - fields on a form{D=Set variable(s) to field values - fields on a form}""
            "condition_action_name="{I:'a5_green_check_small'}{I:'a5_vertical_line'}{I:'a5_set_variable'} Set variable(s) to field values - fields on a form{D=Set variable(s) to field values - fields on a form}""
            "
            "[2]"display="""
            "sub_action_name="""
            "action_comment="Open file: 51""
            "action="Open a non-Alpha Five file""
            "bitmap="a5_blue_open_file""
            "has_condition=.F."
            "same_as_previous=.F."
            "condition_type_index=1"
            "condition_flag="""
            "condition_expression="""
            "parameter_string=""%str%
            "parameter_array"[1]"name="specify_or_prompt""
            "type="n""
            "comment="1 = Specify name now, 2 = Prompt at runtime. , 3 = variable, 4 = expression""
            "value=1"
            "
            "[2]"name="file_name""
            "type="c""
            "comment="File to open""
            "value="c:/_Stamp ID Illus/51.jpg""
            "
            "[3]"name="variable_name""
            "type="c""
            "comment="""
            "value="""
            "
            "[4]"name="expression""
            "type="c""
            "comment="""
            "value="""
            "
            "
            %str%"
            "flag_variables="""
            "script_variables="""
            "edit_with="xg1_open_foreign_file""
            "generate_with="xg2_open_foreign_file""
            "xbasic_code=""%str%
            'Open file: 51
            if file.exists("c:/_Stamp ID Illus/51.jpg") then
            sys_open("c:/_Stamp ID Illus/51.jpg")
            else
            ui_msg_box("Error Opening File","File 'c:/_Stamp ID Illus/51.jpg' does not exist.",ui_stop_symbol)
            end if
            %str%"
            "post_process_code="""
            "help_topic="Open a Non-Alpha Five File|1""
            "action_name="{I:'a5_blue_open_file'} Open a non-Alpha Five file{D=Open a non-Alpha Five file}""
            "condition_action_name="{I:'a5_green_check_small'}{I:'a5_vertical_line'}{I:'a5_blue_open_file'} Open a non-Alpha Five file{D=Open a non-Alpha Five file}""
            "
            "
            The two actions are actually:
            Set variable(s) to field values - fields on a form
            and
            Open a non-Alpha Five file.

            I would think that I would need to creat a variable that whenever a record is opened, it puts the current record number in that variable and that variable would replace the file named "51" in the above example.

            Thanks,
            Rich

            Comment


              #7
              RE: showing a photo

              Rich,

              Did action scripting create that code??? I don't really follow what it is doing. Too much excess stuff.

              What I did see was that in this code snippet,

              %str%"
              "flag_variables="""
              "script_variables="""
              "edit_with="xg1_open_foreign_file""
              "generate_with="xg2_open_foreign_file""
              "xbasic_code=""%str%
              'Open file: 51
              if file.exists("c:/_Stamp ID Illus/51.jpg") then
              sys_open("c:/_Stamp ID Illus/51.jpg")
              else
              ui_msg_box("Error Opening File","File 'c:/_Stamp ID Illus/51.jpg' does not exist.",ui_stop_symbol)
              end if
              %str%"

              You need to replace the 51 with a variable that gets set to the record-id.

              Something like this:
              dim file_id as C
              file_id = alltrim(str(record-ID))

              if file.exists("c:/_Stamp ID Illus/"+file_id+".jpg") then
              sys_open("c:/_Stamp ID Illus/"+file_id+".jpg")
              else
              ui_msg_box("Error Opening File","File 'c:/_Stamp ID Illus/'+file_id+'.jpg' does not exist.",ui_stop_symbol)
              end if



              Let me know if this works.

              Tom

              Comment


                #8
                RE: showing a photo

                Rich,

                ...and this is what we do on our customer image form. This code is in the on_fetch event of the form.

                'Date Created: 14-Mar-2005 03:06:18 PM
                'Last Updated: 15-Mar-2005 10:56:41 AM
                'Created By : Tom Henkel
                'Updated By : Tom Henkel
                'debug(1)
                dim aa as P
                aa = addin.variables()
                pict1=image-"image
                oldfile = "O:\IMAGES"+chr(92)+trim(pict1)+".bmp"
                if .not. file.exists(oldfile)
                oldfile = "O:\IMAGES"+chr(92)+"not_avail.bmp"

                end if

                topparent:Bitmap1.bitmap.filename = oldfile



                Hope it helps.

                Tom

                Comment

                Working...
                X