Page 1 of 1

show a message then created a dialog and not before

Posted: Fri Aug 23, 2019 3:38 pm
by Silvio.Falconi
I have a dialog
at init go to add a array aItems I need on xbrowse from a function calcolo()

if I make a check calcolo function have some message boxes

I wish before create the dialog with all object and then the calcolo function can show the messages

my problem is the message is showed before to create the dialog

how I can resolve it ?

I made a small test

Code: Select all | Expand

#include "fivewin.ch"

Function test()
Local odlg,oFolder,oPanelGreen
Local aItems:= {}
LOCAL oBrowse
 DEFINE DIALOG oDlg TITLE "test" SIZE 1120,650 ;
             PIXEL TRUEPIXEL RESIZABLE

 @ 1, 0 FOLDEREX oFolder OF oDlg SIZE oDlg:nWidth-585,oDlg:nHeight-390 PIXEL  ;
        PROMPT "Reservation","Payments"


     @ 100, 02 XBROWSE  oBrowse OF oFolder:aDialogs[1] ;
       ARRAY aItems       ;
        SIZE 100,90 PIXEL STYLE FLAT NOBORDER

         WITH OBJECT oBrowse
            :CreateFromCode()
    END








         oDlg:bResized  := <||
                local oRect    := oDlg:GetCliRect()
                oFolder:nWidth     := oRect:nRight-2
                oFolder:nHeight    := oRect:nBottom-60

                oPanelGreen:nTop   := oRect:ntop +80
                oPanelGreen:nLeft  := oRect:nleft+5
                oPanelGreen:nwidth := oRect:nRight - 20

                oBrowse:nTop      := oRect:nBottom-350
                oBrowse:nWidth    := oRect:nWidth - 15
               return nil
                  >


 ACTIVATE DIALOG oDlg CENTERED;
                ON INIT ( oPanelGreen  := PanelGreen(oFolder),;
                 Calcolo(@aItems),EVAL( oDlg:bResized))

return nil

//-----------------------------------------------//
 function PanelGreen(oFld)
  local oPanel,oBrushGreen
  Local aGradgreen := { Rgb( 225,239,219),Rgb( 225,239,219)}
  DEFINE BRUSH oBrushGreen GRADIENT aGradgreen
     oPanel:=Tpanel():New( 35, 2, 75, oFld:aDialogs[1]:nWidth-5, oFld:aDialogs[1])
     oPanel:SetBrush( oBrushGreen )
     oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }
     return oPanel
//-----------------------------------------------//


function Calcolo(aItems)
   msginfo("wwww")
   return aItems
//-----------------------------------------------//

Re: show a message then created a dialog and not before

Posted: Fri Aug 23, 2019 4:07 pm
by ukoenig
Silvio,

just change to :
.....
.....
oDlg:bPainted := {||Calcolo(@aItems) }

ACTIVATE DIALOG oDlg CENTERED;
ON INIT ( oPanelGreen := PanelGreen(oFolder),;
EVAL( oDlg:bResized))

regards
Uwe :D

Re: show a message then created a dialog and not before

Posted: Fri Aug 23, 2019 4:49 pm
by Silvio.Falconi
each time I resize it come the message ...no good

Re: show a message then created a dialog and not before

Posted: Fri Aug 23, 2019 4:55 pm
by ukoenig
Silvio,

You can use a var that will show the message only at once.

lMessage := .F.
oDlg:bPainted := {|| IIF( lMessage = .F., ( Calcolo(@aItems), lMessage := .T.), NIL ) }


regards
Uwe :?:

Re: show a message then created a dialog and not before

Posted: Fri Aug 23, 2019 6:58 pm
by Silvio.Falconi
goods :) it an good idea

Re: show a message then created a dialog and not before

Posted: Thu Aug 05, 2021 11:37 am
by VictorCasajuana
oDlg:bStart := {||Calcolo(@aItems) }