[Gambas-devel] Programming a component with gambas
Lars Hoeger
gambasdeveloper at ...628...
Fri Mar 6 16:41:41 CET 2009
Hello,
i try to program a virtual component (it is the first one) which
connects to a Server and communicates with it. I allready read the
dokumentation How To Program Components In Gambas
<http://gambasdoc.org/help/dev/gambas?view> an walked through all the
code located in the /comp/src directory.
The component has only three properties which should be set in the
gambas-IDE as well as by code.
Everything works fine: in the gambas ide you can place the new control
on a form and the properties where shown as they should be.
If I run the program it stops with "Not enough arguments". I think in
comes from the _init() part.
If I create a new Control in my Code:
DIM CTItmp as new CTI(Fmain),
it works, but without the default values. Can anyone explain me, what i
did wrong?
Here is the Code of the Control called CTI (its picture is named
cti.png). It should just print the given values. The rest of the
functionality will come later...
' Gambas class file
EXPORT
INHERITS UserControl
EVENT CTIReady
EVENT CTINotReady
EVENT TELAlerting
EVENT TELRinging(Anrufer AS String)
EVENT TELInBound
EVENT TELOutBound
PROPERTY Port AS Integer
PROPERTY Server AS String
PROPERTY Nebenstelle AS Integer
PUBLIC CONST _Properties AS String =
"Port=12345,Server=192.168.0.1,Nebenstelle=100"
PRIVATE INTport AS Integer
PRIVATE STRserver AS String
PRIVATE INTnebenstelle AS Integer
PUBLIC SUB _new()
PRINT "New:"
PRINT STRserver
PRINT INTport
PRINT INTnebenstelle
END
STATIC PUBLIC SUB _init()
PRINT "_init() :-)"
END
PUBLIC SUB Connect()
PRINT "Will connect to " & STRserver
END
PRIVATE FUNCTION Port_Read() AS Integer
RETURN INTport
END
PRIVATE SUB Port_Write(Value AS Integer)
INTport = Value
END
PRIVATE FUNCTION Server_Read() AS String
RETURN STRserver
END
PRIVATE SUB Server_Write(Value AS String)
STRserver = Value
END
PRIVATE FUNCTION Nebenstelle_Read() AS Integer
RETURN INTnebenstelle
END
PRIVATE SUB Nebenstelle_Write(Value AS Integer)
INTnebenstelle = Value
END
Regards
Lars Hoeger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20090306/c2e445c0/attachment.html>
More information about the Devel
mailing list