On Sun, 21 Jun 2009, Pritpal Bedi wrote:
Hi
> XbpSLE is cast message. It returns special pseudo object
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> How I can retrieve this pseudo object?
> I need value of a property in the XbpComboBox():new() itself
> of the instance respresenting XbpSLE().
Such instance does not exists. Part of area (instance variables) inside
oXbpComboBox belongs to XbpSLE. But it's inside one object. There is
no separate copy of this object with only XbpSLE() ivars.
Cast messages informs only compiler/vm that part of instance are inside
oXbpComboBox should be unconditionally used.
> Now I have resolved it like this ( not an elegant solution )
> *******************************************
> CLASS XbpComboBox INHERIT XbpSLE, XbpListBox
> DATA type INIT XBPCOMBO_DROPDOWN
> ........
>
> DATA oSLE
> ACCESS XbpSLE INLINE ::oSLE
> DATA oLB
> ACCESS XbpListBox INLINE ::oLB
> ENDCLASS
>
> METHOD XbpComboBox:create( oParent, oOwner, aPos, aSize, aPresParams,
> lVisible )
> ::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
> ::oSLE := XbpSLE():new():create( oParent, oOwner, aPos, aSize,
> aPresParams, lVisible )
> ::oLB := XbpListBox():new():create( oParent, oOwner, aPos, aSize,
> aPresParams, lVisible )
???
If you are keeping XbpSLE and XbpListBox in instance variables why
you are inheriting from theses clases? In such case you have XbpSLE
instance area inside XbpComboBox object and second copy of other
instance area inside Self:XbpSLE. The same happens with XbpListBox.
Looks like logical mistake for me because you have two independent
XbpSLE and XbpListBox objects. Was it your intention to create sth
like that?
Maybe you wanted to make st like:
METHOD XbpComboBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::XbpSLE:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::XbpListBox():create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
In the above example create message in XbpComboBox() executed CREATE
messages inherited from xbpWindow, XbpSLE and XbpListBox to initialize
parts of instance area which belongs to above classes. Because CREATE
message exists in all these classes casting is necessary to chose the
valid one. The ::oSLE and ::oLB instance variables are not necessary
in such code at all.
> ::oWidget := QComboBox():New( ::pParent )
> vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
> ::oWidget:setLineEdit( ::XbpSLE:oWidget:pPtr )
> ::oWidget:setEditable( ::XbpSLE:editable )
> ::oWidget:setFrame( ::XbpSLE:border )
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Where I need XbpSLE's instance
> ::connect( ::pWidget, "highlighted(int)" , {|o,i| ::exeBlock( 1,i,o
> ) } )
> ::connect( ::pWidget, "currentIndexChanged(int)", {|o,i| ::exeBlock( 2,i,o
> ) } )
> ::setPosAndSize()
> IF ::visible
> ::show()
> ENDIF
> ::oParent:AddChild( SELF )
> RETURN Self
> *******************************************
Sorry but I do not understand why you need XbpSLE's instance and
what you want to do. I do not know xBase++ and what these classes do.
best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour