[Gambas-user] SPawing pictureboxs

Richard Muir-Gladman richard at ...2079...
Sat Mar 28 21:40:11 CET 2009


I use this code to create my "picture boxes" which are actually buttons.
I did this because I couldn't find a click event for a picture box.

PRIVATE SUB addPicture(pName AS String, title AS String, id AS Integer)
    DIM f AS Frame
    DIM p AS Button
    
    f = NEW Frame(scrPictures)
    f.Text = Left$(title, 15)
    f.w = 130
    f.h = 130
    
    p = NEW Button(f) AS "pictureItem"
    p.Name = pName
    p.tag = id
    p.ToolTip = title
    p.W = 100
    p.h = 100
    p.x = 14
    p.y = 21
      
    p.Picture = Picture.Load(Global.pictureCache &/ "thumbs" &/ pName)
  
END 

This is the click handler for the button

PUBLIC SUB pictureItem_Click()
  DIM f AS NEW PictureDetail
  f.id = LAST.tag
  f.ShowDialog
END

It's not exactly what you wanted but it does work quite nicely

Richard.

On Sat, 2009-03-28 at 13:15 -0700, jbskaggs wrote:
> I want to be able to spawn a series of indentical pictureboxes then if I
> click on an individual pixturebox get it to run code for that picturebox.
> 
> I can genrate the pictureboxes just fine with the =new picturebox but then I
> cant use the picturebox with Public sub picturebox_mousedown() command as I
> would a picturebox I drew.  How would I go about doing that and giving the
> pictureboxes unique names that I can use with the mouse.
> 
> So could somebody give a little example that generates  three or four
> identical pictureboxes and how I can use the _mousedown or _click events?
> 
> Pretty please:jumping:
> 
> JB SKaggs
-- 
Quantum materiae materietur marmota monax si marmota monax materiam
possit materiari?
(How much wood would a woodchuck chuck if a woodchuck could chuck wood?)

Registered Linux User: #459086





More information about the User mailing list