Page 1 of 1

nowait

PostPosted: Fri Mar 10, 2023 10:56 am
by Silvio.Falconi
Image


I open dbf with tdatabase why make error ?


is it possible to use a dialog in source (and not in resource) using the NOWAIT clause?

Meaning what

DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
FONT oFont COLOR CLR_BLACK, DLG_nColorDlg

ACTIVATE DIALOG oDlg NOWAIT



RETURN (NIL)

Re: nowait

PostPosted: Fri Mar 10, 2023 3:24 pm
by karinha
Hello, you must show how you are doing the OPENING of the Database, because the ERRSYSW.prg is saying that the OPEN AREA IS NOT IN USE.

Hola, debes mostrar como estas haciendo la APERTURA de la Base de Datos, porque el ERRSYSW.prg esta diciendo que el AREA ABIERTA NO ESTÁ EN USO.

And why does this DIALOGUE need to be NOWAIT?

¿Y por qué este DIÁLOGO necesita ser NOWAIT?

Regards, saludos.

Re: nowait

PostPosted: Fri Mar 10, 2023 9:36 pm
by cmsoft
Se que no es lo que necesitas porque usas tdatabase, pero tal vez te de un hilo para seguir.
Code: Select all  Expand view

#include "FiveWin.ch"
static oWnd
static lEnd := .f., nArea
//----------------------------------------------------------------------------//
function Main()
nArea := 0
   DEFINE WINDOW oWnd TITLE "Dialogo NoWait"

   @ 2,  2 BUTTON "&Start" SIZE 80, 20 ACTION StartTest()
   @ 2, 20 BUTTON "&Info" SIZE 80, 20 ACTION MsgInfo(select())
   @ 2, 40 BUTTON "&Close Area" SIZE 80, 20 ACTION dbclosearea(select()) // Esto es para que de error al querer volver a ese dialogo nowait
   ACTIVATE WINDOW oWnd MAXIMIZED
return nil

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

function StartTest()
   local oDlg
   local oBrw   , n
   nArea ++
   n := nArea
   USE Customer ALIAS "customer"+ALLTRIM(STR(nArea)) SHARED NEW
   INDEX ON Field->State TO State
   SET ORDER TO "State"
      DEFINE DIALOG oDlg TITLE "No Wait Customer"+ALLTRIM(STR(nArea)) FROM 10, 10 TO 23, 70 RESIZABLE
      @ 01,01 XBROWSE oBrw OF oDlg ;
        LINES STYLE FLAT NOBORDER ;
        COLUMNS "State","City", "Last", "First" ;
        HEADERS "State","City", "Last", "First" PIXEL SIZE 200,70
      oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW
      oBrw:CreateFromCode()  
      oBrw:bGotFocus := {|| dbselectarea(oBrw:cAlias)}
      ACTIVATE DIALOG oDlg NOWAIT VALID(Cerrar(n))
      SysRefresh()
return nil

STATIC FUNCTION Cerrar(n)
dbclosearea( "customer"+ALLTRIM(STR(nArea)))
RETURN .t.
//----------------------------------------------------------------------------//
 

Los xbrowse con dialogos nowait funcionan bien, pero si cerramos un area de un dialogo que esta activo, ahi obtenemos el error.
Intuyo que por ese lado viene el problema

Re: nowait

PostPosted: Mon Mar 13, 2023 2:32 am
by nageswaragunupudi
Silvio.Falconi wrote:Image


I open dbf with tdatabase why make error ?


is it possible to use a dialog in source (and not in resource) using the NOWAIT clause?

Meaning what

DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
FONT oFont COLOR CLR_BLACK, DLG_nColorDlg

ACTIVATE DIALOG oDlg NOWAIT



RETURN (NIL)



Yes.
But close the oDbf in the valid clause but not after activate command.

This works for modal dialigs ( not nowait):
Code: Select all  Expand view

   ACTIVATE DIALOG oDlg
   oDbf:Close()
return nil
 

But this does not work for non-midal ( NOWAIT) dialogs.
Results in the same error as above.

WRONG
Code: Select all  Expand view

   ACTIVATE DIALOG oDlg NOWAIT
   oDbf:Close()
return nil
 


CORRECT WAY
Code: Select all  Expand view

   ACTIVATE DIALOG oDlg NOWAIT ;
      VALID ( oDbf:Close(), .T. )
return nil
 

Re: nowait

PostPosted: Mon Mar 13, 2023 7:49 am
by Silvio.Falconi
thanks I resolved with Cesar

Re: nowait

PostPosted: Mon Mar 13, 2023 8:20 am
by Silvio.Falconi
nageswaragunupudi wrote:
Silvio.Falconi wrote:Image



WRONG
Code: Select all  Expand view

   ACTIVATE DIALOG oDlg NOWAIT
   oDbf:Close()
return nil
 


CORRECT WAY
Code: Select all  Expand view

   ACTIVATE DIALOG oDlg NOWAIT ;
      VALID ( oDbf:Close(), .T. )
return nil
 


WELCOME BACK AMONG US

Re: nowait

PostPosted: Mon Mar 13, 2023 11:13 am
by Antonio Linares
So glad to see you here with us Dear Rao :-)

Re: nowait

PostPosted: Mon Mar 13, 2023 11:15 am
by Silvio.Falconi
nageswaragunupudi wrote:
Silvio.Falconi wrote:Image



CORRECT WAY
Code: Select all  Expand view

   ACTIVATE DIALOG oDlg NOWAIT ;
      VALID ( oDbf:Close(), .T. )
return nil
 



Nages,
I made as you wrote me
Code: Select all  Expand view
 
ACTIVATE DIALOG oDlg NOWAIT ;
      VALID ( oDbf:Close(), .T. )
 


but sometimes have the same error when there is only one dialog opened
it not happened with more dialog opened with same or more dbf

it happen because on xbrowse I have a small menupopup



Image


Code: Select all  Expand view

  oBrw:bRClicked := {|nRow,nCol| MenuContextual(nRow,nCol,oDlg,oBrw,oArticoli) }
 


and the function MenuContextual
Code: Select all  Expand view

Function MenuContextual(nRow,nCol,oDlg,oBrw,oDbf )
   local oMenu

           MENU oMenu POPUP 2015

       
           MENUITEM "al primo record  " +space(6)+ CHR(VK_TAB) + "Ctrl+Home";
              MESSAGE "Mostra la lista dal primo record";
              RESOURCE "GRID_TOP";
              ACTION oBrw:KeyDown(VK_HOME, 0)  WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "a pagina prec.  " +space(6)+ CHR(VK_TAB) + "Pag. Sù";
              MESSAGE "Mostra la lista della pagina precedente";
                RESOURCE "GRID_PREVIOUS";
              ACTION oBrw:KeyDown(VK_PRIOR, 0) WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "al precedente record  " +space(6)+ CHR(VK_TAB) + "Indietro";
              MESSAGE "Mostra la lista muovendosi  al record precedente ";
                RESOURCE "GRID_UP";
              ACTION oBrw:KeyDown(VK_UP, 0)   WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "avanti di un record  " + CHR(VK_TAB) +space(6)+ "Avanti";
              MESSAGE "Mostra la lista muovendosi al record avanti";
                RESOURCE "GRID_DOWN";
              ACTION oBrw:KeyDown(VK_DOWN, 0)  WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "a pag. avanti  " +space(6)+ CHR(VK_TAB) + "Pag. Giù";
              MESSAGE "Mostra la lista della pagina avanti";
               RESOURCE "GRID_NEXT";
              ACTION oBrw:KeyDown(VK_NEXT, 0)  WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "all'ultimo record  " +space(6)+ CHR(VK_TAB) + "Ctrl+End";
              MESSAGE "Mostra la lista all'ultimo record";
                RESOURCE "GRID_BOTTOM";
              ACTION oBrw:KeyDown(VK_END, 0)  WHEN oDbf:OrdKeyCount() > 0
         ENDMENU
   ACTIVATE POPUP oMenu OF oDlg AT  oBrw:nTop+nRow, oBrw:nLeft+nCol
     return oMenu

Re: nowait

PostPosted: Mon Mar 13, 2023 11:22 am
by Enrico Maria Giordano
Antonio Linares wrote:So glad to see you here with us Dear Rao :-)


I'm happy for Rao recovery too!

Re: nowait

PostPosted: Tue Mar 14, 2023 7:27 am
by nageswaragunupudi
Thank you