On Thu, 02 Oct 2014, Jorge Carri??n wrote: > Excuse my poor English. What I mean with "processing properties" is the > execution of triggered methods _read and _write of the propertie. > What I mean is somenthing like that: > > Export > > Inherits TableView > > Public Const _Properties As String = "*,conexion,sqlstring" > > Property conexion As Connection > Property sqlstring As String > > Private $conexion As Connection > Private $sqlstring As String > > Public Sub fill_the_grid() > > $conexion.Exec($sqlstring) > ... > etc. > .... > > End > > Public Function conexion_read() As Connection > > Return $conexion > > End > Public Sub conexion_Write(Value As Connection) > > $conexion = Value > > End > > Public Function sqlstring_read() As String > > Return $sqlstring > > End > Public Sub sqlstring_write(value As String) > > $sqlstring = value > fill_the_grid() > > End > > > Both properties, conexion and sqlstring, are filled with its values in the > IDE in design time. > When run the program, somtimes the sqlstring_write sub is launched before > conexion_write() sub. And then, obviously there are a error in > $conexion.Exec($sqlstring) line... > Some times If I change the size of the form or if I add som controls more > to the form, it works fine. > > There is a way to force the conexion property to be filled before de > sqlstring property? > > Hope this time I've been more clear. >
Yes, it was. (Let me make a quick note on vocabulary here before I proceed: you said you programmed a "component" but "component" in the narrower sense around Gambas means a sort of shared library (the gb.* things you link to your project, like gb.qt4). Your class above _may_ be part of a component but you are actually talking about what we normally call a "control", i.e. a class which can be put on a graphical form. I know people who call both things "component" but this often leads to confusion. And your question revolves around that single class, and whether it's part of a component is irrelevant here. Remember the 4 C's: classes, controls, components and confusion :-)) About your question: If I was you, I wouldn't want to rely on a specific order of execution. What if the user sets conexion = Null *mid-execution*? You need to handle the case $conexion = Null in your fill_the_grid(): Public Sub fill_the_grid() If Not $conexion Or If Not $conexion.Opened Then Return ' Do nothing $conexion.Exec($sqlstring) ' etc. End Similarly, maybe $sqlstring should get a sensible default value since IIRC an empty Exec() also throws an error. Does this help you? Regards, Tobi -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user