I've Notice that using a treeview inside a Container, the treeview don't get Focus (GOTFOCUS() not fired).
To prove this behavior wrote the following code, where i create a form with a treeview and a button.
When you call the first line's CREATEOBJECT with second parameters to .F. the treeview will placed directly in the form, but if you pass a value of .T. in the second parameter the treeview will be contained in a container.
If you press TAB-Key in the first case (second parameter = .F.) you'll switch beetween treeview and button .... but when you'll pass .t. in the second parameter the only way to "set on fire" treeview is using the mouse .....
If you try code you'll see the strange behavior .... and if you'll have a workaround to use TAB-Key even if there is a container i'll be grateful.
Thanks in advance
Emanuele!
bonin@Artelnet.it
_____O/________O/____ CUT HERE _________
O\ O\
oform = CREATEOBJECT("mainform", .F.)
oform.visible = .t.
READ EVENTS
RETURN
DEFINE CLASS mainform AS FORM
FUNCTION INIT(lUseContainer)
IF !DODEFAULT()
RETURN .F.
ENDIF
IF lUseContainer
THIS.ADDOBJECT("TV", "MycntTV")
THIS.tv.tv.createnode()
ELSE
THIS.ADDOBJECT("TV", "MyTV")
THIS.tv.createnode()
ENDIF
THIS.ADDOBJECT("btn", "CommandButton")
THIS.btn.caption = 'Dummy '
THIS.btn.visible = .T.
THIS.btn.top = THISFORM.Height - THIS.btn.height
ENDFUNC
FUNCTION DESTROY()
CLEAR EVENTS
DODEFAULT()
ENDFUNC
ENDDEF
DEFINE CLASS MyCntTV AS Container
ADD OBJECT TV AS MyTV
FUNCTION GotFocus()
ACTI SCREEN
? 'Container GotFocus'
ENDFUNC
FUNCTION INIT()
THIS.tv.top = 1
THIS.tv.left = 1
THIS.HEIGHT = THIS.TV.HEIGHT+ 2
THIS.WIDTH = THIS.TV.WIDTH + 2
ENDFUNC
ENDDEF
DEFINE CLASS MyTv AS OLECONTROL
OLECLASS = "MSComctlLib.TreeCtrl"
VISIBLE =.T.
FUNCTION INIT()
THIS.LINESTYLE = 1
THIS.STYLE = 7
THIS.HEIGHT = THISFORM.HEIGHT - 40
THIS.WIDTH = THISFORM.WIDTH - 50
ENDFUNC
FUNCTION GotFocus()
ACTI SCREEN
? 'TV GotFocus'
ENDFUNC
FUNCTION CreateNode()
LOCAL oNode
WITH THIS
oNode = .Nodes.ADD(, 1, "Node1", "Node1")
oNode = .Nodes.ADD("Node1", 4,"Node2", "Node2")
ENDWITH
ENDFUNC
ENDDEFINE
_____O/________O/____ CUT HERE _________
O\ O\
bye, Emanuele!
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.