TPrinter with GetWndDefault()

Post Reply
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

TPrinter with GetWndDefault()

Post by Enrico Maria Giordano »

In the following sample GetWndDefault() returns NIL after TPrinter is used and then it continues to return NIL:

Code: Select all | Expand

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    @ 1, 1 BUTTON "Print";
           ACTION PRINT()

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


STATIC FUNCTION PRINT()

    LOCAL oPrn

    ? GETWNDDEFAULT()

    PRINT oPrn PREVIEW MODAL
        PAGE
        ENDPAGE
    ENDPRINT

    ? GETWNDDEFAULT()

    RETURN NIL


EMG
User avatar
Antonio Linares
Site Admin
Posts: 42519
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: TPrinter with GetWndDefault()

Post by Antonio Linares »

Enrico,

GetWndDefault() returns the most recently used window or dialog, so once the preview window is created then GetWndDefault() changes and finally it set to nil and the preview window is destroyed.

We don't keep a stack of previously used windows. In case you need to locate the current one you may use:

oWndFromHwnd( GetFocus() ) or

oDlgFromHwnd( GetFocus() )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply