How can i create image selection field?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

SEAL29
Posts: 63
Joined: Fri Oct 02, 2020 3:32 pm

Re: How can i create image selection field?

Post by SEAL29 » Sat Oct 10, 2020 6:56 am

Would be a lot of pictures in the runtime, when I would use the program. How do i link only the image reference during the runtime in stendalone application?

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How can i create image selection field?

Post by Klaus » Sat Oct 10, 2020 9:54 am

Hi SEAL29,

just like my last exampole script, but without the "import paint" part.
Therefore you need to have an empty image object on your card or create a new image on the fly:

Code: Select all

on mouseup
  ## Show the system OPEN dialog:
  answer file "Please select an image file." with type "Images|jpg,jpeg,gif,png|" 

  ## IT contains the path of the selected image file
  put it into tFile

  ## Check if user clicked CANCEL
  if the result = "Cancel" then
    exit mouseup
  end if

  ## 1. In case you already have an image object on your card for the user selected image:
  ## set the filename of img "your image here" to tFile
  
  ## 2. In case you do not have an image object already, we create one:
  ## create image "name of new image here"
  ## set the filename of img "name of new image here" to tFile

   ## Now scale image and set its loc etc...
   ## ...
end mouseup
Best

Klaus

SEAL29
Posts: 63
Joined: Fri Oct 02, 2020 3:32 pm

Re: How can i create image selection field?

Post by SEAL29 » Sat Oct 10, 2020 3:53 pm

This is incredible community. Thanks for plenty helps and patience for everyone. :D

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7391
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: How can i create image selection field?

Post by jacque » Sat Oct 10, 2020 5:09 pm

SEAL29 wrote:
Sat Oct 10, 2020 6:56 am
Would be a lot of pictures in the runtime, when I would use the program. How do i link only the image reference during the runtime in stendalone application?
There's a lesson about this:
http://lessons.livecode.com/m/4603/l/56 ... ing-images
Scroll down to the section on referencing images.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply