VERSIONS: Paradox 9 and later
SUBJECT: Ghost object created for table bound fields
BY: IVICA KOLAR
Note: This text was earlier found in DocIssues, Wadid 222
When creating a form based on a table, Paradox will during execution create temporary text objects for some (maybe all) of the tablebound
fields. The text object has the same name for every container. During the tests, it was always named #Text28. Maybe it is one object being moved
when tabbing between fields.
This behaviour is first verifed in Paradox 9 SP4. It does not happen in P7 SP4 and P8 SP1. It could be part of the new solution for required
fields introduced by Corel in P9.
Object has been identified in forms with a tableFrame object or a Mro object. It has not been tested in a form with no record container.
When using enumUiobjectNames(), you should be aware of the existence of this object.
SETUP:
- Create a new form. Put tableFrame on it. Bind tableFrame to a table
- 2. Add the code below to action method at tableFrame level
- 3. Save/Close/Run
- 4. Move between tableFrame fields using keyboard
Result:Unexpected ui encountered.
proc uGhostHunting(id smallint)
var
ui UIObject
stFullName, stContainer String
arstObjects Array[] String
liCounter Longint
darstProperties DynArray[] string
endvar
;target field in current record
stFullName = active.FullName
stContainer = active.ContainerName
ui.attach( stContainer )
ui.enumObjectNames( arstObjects )
liCounter = arstObjects.indexOf( stFullName ) +1
if liCounter < arstObjects.size() then
if ui.attach(arstObjects[ liCounter ]) then
if ui.Class = "Text" then
;P10: Ghost Text ui is here
ui.enumUIObjectProperties(darstProperties)
darstProperties.view("Ghost attack! Id= "+string(id))
;BTW: Do you know that we can move to Text ui?
; ui.moveTo() does that.
endif
endif
endif
endproc
method action(var eventInfo ActionEvent)
var
siId SmallInt
endvar
siId = eventInfo.id()
switch
case siId = FieldForward :
case siId = MoveRight :
case siId = FieldRight :
case siId = FieldBackward :
case siId = MoveLeft :
case siId = FieldLeft :
otherwise:
return
endswitch
uGhostHunting(siId)
endMethod
endMethod