TPrinter with GetWndDefault()

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
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

#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: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
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