Framework is difficult

Post Reply
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Framework is difficult

Post by DGDanforth »

I would like to clean up a large portion of the documentation for BB.
I think that will take all of us working together.
In general I find it difficult to use and understand.
Some parts are much better than others.

Right now I am struggling to understand why the focus frame does not have a rider.

Code: Select all

focusFrame := Controllers.FocusFrame();
focusFrame.SetCursor(Ports.refCursor);
crashes because the rider is NIL. Why?
The documentation on this point is opaque.

Comments?
-Doug
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Framework is difficult

Post by Ivan Denisov »

Because there can be situation without focus frame?

Code: Select all

    focusFrame := Controllers.FocusFrame();
    IF focusFrame # NIL THEN
        focusFrame.SetCursor(Ports.refCursor);
    END;
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Framework is difficult

Post by DGDanforth »

Ivan Denisov wrote:Because there can be situation without focus frame?

Code: Select all

    focusFrame := Controllers.FocusFrame();
    IF focusFrame # NIL THEN
        focusFrame.SetCursor(Ports.refCursor);
    END;
Ivan,
The focusFrame is not NIL and yet it does not have a rider.
I am hypothesizing that the call to the function, say, GetFrame
is done by a Commander and that the focus is actually the
commander and not the document in which the commander
is embedded. If true then that means the getting of the focus
must be activated either by a menu or by, say, a tools dialog.

Again, the complexity of this not trivial.
-Doug
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Framework is difficult

Post by DGDanforth »

When does a frame have a rider?
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Framework is difficult

Post by Ivan Denisov »

DGDanforth wrote:When does a frame have a rider?
The more interesting question, when does a frame have no rider? Doug, can you please describe your case with some more details. There is clear stated in documentation, that usually developer should not care about this riders. That is an element of internal realization of the framework. So how did you catch this bug?
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Framework is difficult

Post by Josef Templ »

The only place where the rider of a Ports.Frame is set is Ports.Frame.ConnectTo.
This is called directly at the following places:

Views.InstallFrame
Views.Close
Documents.Print
Windows.Open
OLEData.Paint
HostBitmaps.Paint

If a rider is not set, the frame is unconnected., i.e. not connected to
a graphics device (display or printer) that defines the pixel size.
The focus frame as returned by Controllers.FocusFrame seems to be
unconnected when called from an ordinary command.
It may be different when called from within a view's message handler.

The docu of SetFocus() says "SetCursor is used in polling loops during mouse tracking."
and at that point it seems that the frame is connected.
Other usages are probably not intended but this is not stated explicitly
(or maybe it is but somewhere else).

- Josef
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Framework is difficult

Post by DGDanforth »

A trap is called when the following is executed

Code: Select all

focusFrame.SetCursor(Ports.refCursor);
but only in a specific case that I have not yet been able to isolate.

When I wrap a view I get a focusFrame whose rider is not NIL (good)
but some where else when I then do a SetCursor with
the same focusFrame the rider is now NIL (bad).

I don't see how the focusFrame is modified.
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: Framework is difficult

Post by DGDanforth »

I just did a test using SYSTEM.ADR.
The pointer focusFrame is not changed between where it was created
and where SetCursor is called. So something has modified the focusFrame internals.
-Doug
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Framework is difficult

Post by Ivan Denisov »

I agree with Doug, that there is lack of developers documentation about framework. When you work with wrapping there are some requirements.

Are you doing you wrapping like it is done in ObxWrappers ?
Post Reply