Re: Genero / Images

"Renan Quezada Dominguez" <[email protected]> Mon, 10 Apr 2006 09:53:07 -0500
Newsgroups gmane.comp.lang.4gl.fourjs.user
Message-ID <000c01c65cae$7ab4c510$c3ff21c8@renan>
***********************
Su correo fue verificado de virus y troyanos por el Centro de Informatica y Telecomunicaciones.
***********-***********


There are two ways I solve that

1. Using a base.Channel and a comboBox, the user can only choose a valid file
    DEFINE f base.Channel,
    picture CHAR(200)
    LET f = base.Channel.create()
    LET cb = ui.ComboBox.forName("formonly.archivos")
    LET inst = "find ../pics -name *[Jj][Pp][Gg]"
    CALL f.openPipe( inst, "r" )
    WHILE f.read([picture])
      LET largo = length(picture CLIPPED) -- 5
      CALL cb.additem(picture CLIPPED,picture CLIPPED)
    END WHILE
    CALL f.close()

2. (I think Better) Verifying the existence of the file in the filesystem

DEFINE rstat INTEGER,

INPUT ...

    AFTER FIELD imagefile
      LET inst = "ls \"/user/",r_tab.imagefile clipped,"\""
      RUN inst RETURNING rstat
      IF rstat != 0 THEN
         CALL mens("The image file do not exist")
         NEXT FIELD imagefile
      END IF

END INPUT





  ----- Original Message -----
  From: Παντελής Μάγκος
  To: [email protected]
  Sent: Monday, April 10, 2006 8:31 AM
  Subject: [fourjs-users] Genero / Images


        ***********************
        Su correo fue verificado de virus y troyanos por el Centro de Informatica y Telecomunicaciones.
        ***********-***********

      

  Genero / Images question
  ------------------------------
  I have a form with an IMAGE item in it (A form field image not a static one)
  The program asks the user to provide a valid image URI and displays it:

  PROMPT "Enter an image URI" FOR imagefile
  DISPLAY imagefile TO img


  When the user types in a valid image file, then the image is displayed normally. When the user types something that does not exists, the program clears the image field BUT (!) i cannot "catch" the fact that "imagefile" was an illegal (or notfound, or .. everything but not a normal ) image file!
  Is there any means to catch this?