[Gambas-user] Re: Treeview data

Rohnny Stormo rohnny at ...1248...
Sun Feb 26 08:47:43 CET 2006


Rohnny Stormo wrote:

> <How to activate the click event and the other events.
> <> If I have understod you correct. I make a new class and ex call it
> <> mytreeview Just the following in the class
> <>
> <> INHERITS TreeView
> <>
> <> public MyTestString as string
> <>
> <> From my form I do as this
> <>
> <> public myTree as new mytreeview(me)
>
> <<
> <public myTree as MyTreeView
> <myTree = new mytreeview(me) AS "myTree"
> <
> <If you don't give an event name, you will never get events!
> <
> <Regards,
> <
> <-- <Benoit Minisini
>

My Test Project
1) Class  name cTextBox
' Gambas class file
INHERITS TextBox

PUBLIC Extra AS String


PUBLIC SUB _New(x AS Integer, y AS Integer, width AS Integer, height AS 
Integer)
 
  ME.X = x
  ME.Y = y
  ME.Width = width
  ME.Height = height 
  ME.Extra = "Hello Extra"
  object.Attach(ME, ME, "me") 
END
PUBLIC SUB me_keyPress()
 
  message("Internal sub")
 
END

2)  Form1
' Gambas class file

PRIVATE tBox AS CtextBox
PUBLIC SUB Form_Open()
  tBox = NEW CtextBox(10, 10, 100, 20, ME) AS "tBox"
END
PUBLIC SUB tBox_KeyPress()
  Message("External Sub - " & tBox.Extra)   
END


This is showing Textbox as it should. It do fire class keypress
If I remove the object.attach it do fire the form tbox_keypress

How to fire them both?
First cTextBox_keypress then, if defined , as here it is, tBox_keypress 
from the main form.



Is it - could it,  be possible to have classes that do inherit showing 
as tool in the gambas toolbox?






-- 
-----------------------------------------
Gambas brings Basic to Linux.
My Gambas Community http://forum.stormweb.no





More information about the User mailing list