Page 1 of 1

xbrowser does not appears after window

PostPosted: Mon Oct 21, 2019 11:57 am
by AntoninoP
Hello, I was testing a my little program, and I want debug an array using xbrowser, but it sometime does not appears.
Look this code:
Code: Select all  Expand view
#include <fivewin.ch>

func main()
   LOCAL oWnd
   XBROWSER {10,20,30,40}
   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd
   XBROWSER {10,20,30,40}
return 0

 


the xBrowser appears one time, but after the windows, it does not.

Re: xbrowser does not appears after window

PostPosted: Mon Oct 21, 2019 4:36 pm
by nageswaragunupudi
Once the main window is closed, no dialog can be created and displayed.

For example,
Code: Select all  Expand view
function Main()

   local oWnd, oDlg

   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd CENTERED

   DEFINE DIALOG oDlg
   ACTIVATE DIALOG oDlg CENTERED

return nil
 

In this case, the dialog will never be displayed.

Re: xbrowser does not appears after window

PostPosted: Tue Oct 22, 2019 7:07 am
by Silvio.Falconi
sorry I not understood

If I generate an array on a Window and then I wish open a xbrowser with the array I cannot make it ?

sample :

DEFINE WINDOW oWnd
aLista:= .......
ACTIVATE WINDOW oWnd CENTERED

xbrowser aLista

Re: xbrowser does not appears after window

PostPosted: Tue Oct 22, 2019 10:00 am
by Jack
Hi,
You have to place the XBROWSE bitween DEFINE WINDOW AND ACTIVATE WINDOW .

Re: xbrowser does not appears after window

PostPosted: Tue Oct 22, 2019 10:07 am
by ukoenig
I think he wants to show changed values after closing the window

#include "FiveWin.ch"
FUNC MAIN()
LOCAL oWnd
XBROWSER {10,20,30,40} // old values
DEFINE WINDOW oWnd
// some valuechanges
ACTIVATE WINDOW oWnd ;
VALID SHOW_NEW()
RETURN NIL

// on window-close the browser shows new values
// ( the window is still open )
// closing the browser closes the window as well
FUNCTIOn SHOW_NEW()
XBROWSER {50,60,70,80} // new values
RETURN .T.


regards
Uwe :?:

Re: xbrowser does not appears after window

PostPosted: Tue Oct 22, 2019 10:19 am
by Silvio.Falconi
Jack wrote:Hi,
You have to place the XBROWSE bitween DEFINE WINDOW AND ACTIVATE WINDOW .


I don't know who you are dear Jack, but please read the question carefully, we're talking about the Xbrowser command, not of xbrowse() func,
so I don't have to put it between "define window" and "activate window" ...
Please next time read first from the first topic ..

Re: xbrowser does not appears after window

PostPosted: Tue Oct 22, 2019 10:43 am
by ukoenig
That will give the needed result
showing a browser with new values after window close :!:

#include "FiveWin.ch"

FUNC MAIN()
LOCAL oWnd, oBtn

XBROWSER {10,20,30,40}

DEFINE WINDOW oWnd

ACTIVATE WINDOW oWnd ;
VALID SHOW_BRW(oWnd)

RETURN NIL

// on window-close shows new values and hides the window
// closing the browser closes the window as well

FUNCTIOn SHOW_BRW(oWnd)

oWnd:Hide()
XBROWSER {50,60,70,80}

RETURN .T.

regards
Uwe :D

Re: xbrowser does not appears after window

PostPosted: Tue Oct 22, 2019 10:47 am
by AntoninoP
It is a FiveWin limitation, I think with a minimal change it can work. It is enough that the SetWndApp can accept zero as value:

Code: Select all  Expand view
#include <fivewin.ch>

proc main()
   LOCAL oWnd
   ? GetWndApp() //0
   XBROWSER {10,20,30,40}
   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd
   ? GetWndApp() // value
   XBROWSER {10,20,30,40} //no windows, because parent is closed
   SetWndApp(0)
   ? GetWndApp() // not change!
   XBROWSER {10,20,30,40}  //no windows, because SetWndApp(0) does not works....
   
 

Re: xbrowser does not appears after window

PostPosted: Tue Oct 22, 2019 10:58 am
by ukoenig
Antonino,

did You test my revised solution

Image

regards
Uwe :?:

Re: xbrowser does not appears after window

PostPosted: Tue Oct 22, 2019 11:48 am
by AntoninoP
uwe, I think your solution works (I don't need to try to see it), but It is pretty different from my initial code.
My opinion is that should be possible create an application that shows a dialog after the main window is closed. It is pretty severe because it is not a win32 limitation but it is created by FiveWin

Re: xbrowser does not appears after window

PostPosted: Tue Oct 22, 2019 12:58 pm
by ukoenig
The same logic

My opinion is that should be possible create an application
that shows a dialog after the main window is closed


#include "FiveWin.ch"

FUNC MAIN()
LOCAL oWnd, oBtn, oFontLarge, oSay

DEFINE FONT oFontLarge NAME "Arial" SIZE 0, -24 BOLD

DEFINE WINDOW oWnd

@ 50, 50 SAY oSay PROMPT "Main-window" SIZE 250, 35 OF oWnd FONT oFontLarge PIXEL
oSay:SetColor( 255, )
oSay:lTransparent := .T.

@ 150, 200 BUTTON "Window" + CRLF + "E&xit" SIZE 100, 50 OF oWnd PIXEL ;
ACTION oWnd:End()

ACTIVATE WINDOW oWnd CENTERED ;
VALID SHOW_DLG(oWnd)

oFontLarge:End()

RETURN NIL

// -----------

FUNCTIOn SHOW_DLG(oWnd)
LOCAL oDlg, oBtn, oFontLarge, oSay

oWnd:Hide()

DEFINE FONT oFontLarge NAME "Arial" SIZE 0, -24 BOLD ITALIC

DEFINE DIALOG oDlg SIZE 300, 300 PIXEL TRUEPIXEL TITLE "Test " + FWVERSION

@ 50, 50 SAY oSay PROMPT "Dialog called from window" SIZE 250, 35 OF oDlg FONT oFontLarge PIXEL
oSay:SetColor( 255, )
oSay:lTransparent := .T.

@ 220, 100 BUTTON "Dialog" + CRLF + "E&xit" SIZE 100, 50 OF oDlg PIXEL ;
ACTION oDlg:End()

ACTIVATE DIALOG oDlg CENTERED

oFontLarge:End()

RETURN .T.
// window will be closed :!:

regards
Uwe :D

Re: xbrowser does not appears after window

PostPosted: Tue Oct 22, 2019 1:31 pm
by AntoninoP
ukoenig wrote:oWnd:Hide()


:lol: :lol:
Nice play
:lol: :lol:

Re: xbrowser does not appears after window

PostPosted: Tue Oct 22, 2019 3:42 pm
by cnavarro
Please try
Code: Select all  Expand view

#include <fivewin.ch>

func main()
   LOCAL oWnd
   XBROWSER {10,20,30,40}
   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd
   // The SETUP clause is used because the command XBROWSER has no "OF" clause (PARENT)
   XBROWSER {10,20,30,40} SETUP ( oBrw:oWnd:oWnd := oWnd )
return nil
 


Code: Select all  Expand view

#include "fivewin.ch"

function Main()

   local oWnd, oDlg

   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd CENTERED
   //SetWndDefault( oWnd )
   DEFINE DIALOG oDlg OF oWnd //OF GetWndDefault()
   ACTIVATE DIALOG oDlg CENTERED
return nil