SOB – Images

One of the SOB types that this executable supports is that of an image.

I suppose one could consider that buttons, labels and images are fundamentally very similar.

Each defines a rectangular area that can respond to a mouse click. The main difference is of course their appearance.


There is a demo 3 Panels,images,download,dragNdrop at the menu option Help / sub-section Screen Object  -Demos which demonstrates a few topics.

Creates an empty SOB  of fixed size 100*100 pixels,  which can later be populated with an image

dim myPicL = sob(LeftP,"add","image.holder",100,100 )

It uses the function downloader  (in the System macros Panel) to download images from this Web site

dim myMic = downloader ("https://ripetech.com/wp-content/uploads/2017/10/Meteor_greenkey_02-1200x803.jpg", "Microphone.jpg")
dim myGuitar = downloader ("https://ripetech.com/wp-content/uploads/2017/10/DSC08618-1200x1793.jpg", "Guitar.jpg")

Creates an image SOB using one of the downloaded images. This image is placed as the last child in a stretched SOB container, so its size is changeable.

dim myPicR = sob(RightP,"add","image",myGuitar )

Creates an image SOB inside an SOB container that is size unmanaged, so that the image is rendered at full size.

dim myPicB = sob(ChildWindow,"add","image",myDropPic )

Once a SOB is defined as image or as an image-holder its image can be changed to another using a command such as:

sob(myPicR ,"SET","IMAGE",myGuitar )
sob(myPicB ,"SET","IMAGE",myMic,1 )

Note how the 5th parameter, optional, is used to decide if the image is displayed full size or not.

The demo includes setting / handling a callback when SOB Image is clicked on by the mouses, and the handling of a file DragnDrop on to a SOB image


Functional specifications for image related SOB commands:
Add – Image.Holder

SOB ( _
<Parent: number expression> ,_
"ADD" , "IMAGE.HOLDER" , _
<WIDTH in PIXELS: Integer expression> , _
<HEIGHT in PIXELS: Integer expression> _
)


Add – Image

SOB (  _
<Parent: number expression> , "ADD" , "IMAGE" , _
<Full file name of image: string expression> , _
Optional <SIZING Boolean: If TRUE, take size of IMAGE. Else, default size) Default = FALSE _
)

——————-

Set – Image

SOB ( _
<Target Screen OBject: number expression> , _
"SET" , _
"IMAGE" , _
<Full file name of image: string expression> , _
Optional <SIZING Boolean: If TRUE, take size of IMAGE. Else, default size) Default = FALSE _
)