FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Dialog Question
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Dialog Question
Posted: Sat Nov 06, 2010 08:19 PM
Hi,

I have a button on the main window of my app that will create a Dialog.
The user clicks the button and the dialog appears ... so far so good.

In the Dialog, I have a "Close" button. The Action tied to this is: oDlg:End()
The user clicks this button and the dialog does away ... still no problem.

Now the user clicks the button on the main window again to create the Dialog but nothing happens.

Main window:
Code (fw): Select all Collapse
    
DEFINE WINDOW oWndMain FROM  0,0 TO MaxRow(), MaxCol() TITLE "EzMon" COLOR RGB(0,0,0),RGB(255,255,255) MENU BuildMenu()
        MakeMainBar()   
        @ 4,  30 BUTTON oBtn1 PROMPT "Activate Monitor 1" of oWndMain SIZE 200,75 ACTION MakeDialog(1)
        @ 4, 100 BUTTON oBtn2 PROMPT "Activate Monitor 2" of oWndMain SIZE 200,75 ACTION MakeDialog(2)      
        @ 12, 30 BUTTON oBtn3 PROMPT "Activate Monitor 3" of oWndMain SIZE 200,75 ACTION MakeDialog(3)
        @ 12,100 BUTTON oBtn4 PROMPT "Activate Monitor 4" of oWndMain SIZE 200,75 ACTION MakeDialog(4)
        @ 20, 30 BUTTON oBtn5 PROMPT "Activate Monitor 5" of oWndMain SIZE 200,75 ACTION MakeDialog(5)
        @ 20,100 BUTTON oBtn6 PROMPT "Activate Monitor 6" of oWndMain SIZE 200,75 ACTION MakeDialog(6)
        @ 28, 30 BUTTON oBtn7 PROMPT "Activate Monitor 7" of oWndMain SIZE 200,75 ACTION MakeDialog(7)
        @ 28,100 BUTTON oBtn8 PROMPT "Activate Monitor 8" of oWndMain SIZE 200,75 ACTION MakeDialog(8)
    ACTIVATE WINDOW oWndMain MAXIMIZED VALID QuitApp()


Dialog (n will be a number from 1 to :-):
Code (fw): Select all Collapse
    DEFINE DIALOG oDlg&n FROM nTop,nLeft to nBottom,nRight TITLE cTitle of oWndMain PIXEL  ;
                             COLOR RGB(0,0,0),RGB(208,221,230) ;
                             STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION) ;
                             TRANSPARENT
        @ 2,40  SAY "SPO2" of oDlg&n PIXEL SIZE 25,10 
        @ 2,150 SAY "HR"   of oDlg&n PIXEL SIZE 25,10 
        @ 10,5  SAY oSaySat&n VAR cSat&n FONT oFontBig PIXEL SIZE 82,37 UPDATE of oDlg&n
        @ 10,110 SAY oSayHR&n VAR cHR&n  FONT oFontBig PIXEL SIZE 82,37 UPDATE of oDlg&n
        @ 1.5,34 BUTTON oBtnInfo PROMPT "Pt. Info" of oDlg&n ACTION PatientInfo()
        @ 2.5,34 BUTTON oBtnQuit PROMPT "Close   " of oDlg&n ACTION oDlg&n:End() 
    ACTIVATE DIALOG oDlg&n NOWAIT


Any ideas why the main window button only works once?
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Dialog Question
Posted: Sat Nov 06, 2010 08:39 PM
Jeff

This code work fine, please post a self container samples to repro the error
Code (fw): Select all Collapse
#include "fivewin.ch"

static oWndMain

function main()

local oBtn1, oBtn2, oBtn3, oBtn4, oBtn5, oBtn6, oBtn7, oBtn8 

    
    DEFINE WINDOW oWndMain TITLE "EzMon" COLOR RGB(0,0,0),RGB(255,255,255) 
        @ 4,  30 BUTTON oBtn1 PROMPT "Activate Monitor 1" of oWndMain SIZE 200,75 ACTION MakeDialog(1)
        @ 4, 100 BUTTON oBtn2 PROMPT "Activate Monitor 2" of oWndMain SIZE 200,75 ACTION MakeDialog(2)      
        @ 12, 30 BUTTON oBtn3 PROMPT "Activate Monitor 3" of oWndMain SIZE 200,75 ACTION MakeDialog(3)
        @ 12,100 BUTTON oBtn4 PROMPT "Activate Monitor 4" of oWndMain SIZE 200,75 ACTION MakeDialog(4)
        @ 20, 30 BUTTON oBtn5 PROMPT "Activate Monitor 5" of oWndMain SIZE 200,75 ACTION MakeDialog(5)
        @ 20,100 BUTTON oBtn6 PROMPT "Activate Monitor 6" of oWndMain SIZE 200,75 ACTION MakeDialog(6)
        @ 28, 30 BUTTON oBtn7 PROMPT "Activate Monitor 7" of oWndMain SIZE 200,75 ACTION MakeDialog(7)
        @ 28,100 BUTTON oBtn8 PROMPT "Activate Monitor 8" of oWndMain SIZE 200,75 ACTION MakeDialog(8)
    ACTIVATE WINDOW oWndMain MAXIMIZED //VALID QuitApp() 

return nil

function MakeDialog( n )

    local oDlg
    local nTop := 10
    local nLeft := 10
    local nBottom := 480
    local nRight := 600
    local cTitle := "Dialog " + StrZero( n , 2 )
    local cSat := Space( 10 )
    local cHR := Space( 10 )
    local oSaySat
    local oBtnInfo, oBtnQuit
    

    DEFINE DIALOG oDlg FROM nTop,nLeft to nBottom,nRight TITLE cTitle of oWndMain PIXEL  ;
                             COLOR RGB(0,0,0),RGB(208,221,230) ;
                             STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION) ;
                             TRANSPARENT
        @ 2,40  SAY "SPO2" of oDlg PIXEL SIZE 25,10 
        @ 2,150 SAY "HR"   of oDlg PIXEL SIZE 25,10 
        @ 10,5  SAY oSaySat VAR cSat PIXEL SIZE 82,37 UPDATE of oDlg
        @ 10,110 SAY oSayHR VAR cHR  PIXEL SIZE 82,37 UPDATE of oDlg
        @ 1.5,34 BUTTON oBtnInfo PROMPT "Pt. Info" of oDlg ACTION MsgInfo( n )
        @ 2.5,34 BUTTON oBtnQuit PROMPT "Close   " of oDlg ACTION oDlg:End() 
    ACTIVATE DIALOG oDlg NOWAIT
    
return nil
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Dialog Question
Posted: Sat Nov 06, 2010 09:02 PM
Here is the code:

Code (fw): Select all Collapse
#include "Fivewin.ch"


STATIC oWndMain, oFontBig
STATIC oDlg1, oDlg2, oDlg3, oDlg4, oDlg5, oDlg6, oDlg7, oDlg8
STATIC cSat1, cSat2, cSat3, cSat4, cSat5, cSat6, cSat7, cSat8
STATIC cHR1, cHR2, cHR3, cHR4, cHR5, cHR6, cHR7, cHR8

Function Main()
    Local oBtn1, oBtn2, oBtn3, oBtn4, oBtn5, oBtn6, oBtn7, oBtn8

   DEFINE FONT oFontBig NAME "ARIAL" SIZE 50, 75 BOLD 
   ACTIVATE FONT oFontBig

    For i = 1 to 8
         c:= alltrim(str(i))
         cSat&c := "---"
         cHR&c  := "---"
    Next

    DEFINE WINDOW oWndMain FROM  0,0 TO MaxRow(), MaxCol() TITLE "EzMon" COLOR RGB(0,0,0),RGB(255,255,255) MENU BuildMenu() //MDI //ICON "\EzSat\DLL\EzIcon2.ico"
        MakeMainBar()   
        @ 6,  30 BUTTON oBtn1 PROMPT "Activate Monitor 1" of oWndMain SIZE 200,75 ACTION MakeDialog(1)
        @ 6, 100 BUTTON oBtn2 PROMPT "Activate Monitor 2" of oWndMain SIZE 200,75 ACTION MakeDialog(2)      
        @ 14, 30 BUTTON oBtn3 PROMPT "Activate Monitor 3" of oWndMain SIZE 200,75 ACTION MakeDialog(3)
        @ 14,100 BUTTON oBtn4 PROMPT "Activate Monitor 4" of oWndMain SIZE 200,75 ACTION MakeDialog(4)
        @ 22, 30 BUTTON oBtn5 PROMPT "Activate Monitor 5" of oWndMain SIZE 200,75 ACTION MakeDialog(5)
        @ 22,100 BUTTON oBtn6 PROMPT "Activate Monitor 6" of oWndMain SIZE 200,75 ACTION MakeDialog(6)
        @ 30, 30 BUTTON oBtn7 PROMPT "Activate Monitor 7" of oWndMain SIZE 200,75 ACTION MakeDialog(7)
        @ 30,100 BUTTON oBtn8 PROMPT "Activate Monitor 8" of oWndMain SIZE 200,75 ACTION MakeDialog(8)
    ACTIVATE WINDOW oWndMain MAXIMIZED VALID QuitApp() 

Return Nil

function BuildMenu()
      MENU oMenu 2007
         MENUITEM "Exit" 
         MENU
            MENUITEM "Exit Program" ACTION QuitApp()  
         ENDMENU
   ENDMENU
return oMenu

function quitapp()
    dbcloseall()
    set resources to
    clear memory
    ResAllFree()
    Syswait(.5)
    quit
return nil

Function MakeMainBar()
   DEFINE BUTTONBAR oBar _3D SIZE 44, 46 OF oWndMain 2007  //36, 40

      DEFINE BUTTON OF oBar FILE "\EzSat\Dll\Fix.bmp"  ;
         MESSAGE "Message";
         TOOLTIP "Tooltip";
         ACTION MsgInfo() 

Return Nil

Function MakeDialog( nDialog )
      Local nTop, nBottom, nLeft, nRight, cTitle:="Monitor # "+ALLTRIM(str(nDialog))
      Local nWide:= 506, nHigh:=127
      Local n
    If nDialog = 1
        nTop    := 93
        nLeft   := 0
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
    Endif
    If nDialog = 2
        nTop    := 93
        nLeft   := 512
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
    Endif
    If nDialog = 3
        nTop    := 253
        nLeft   := 0
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
    Endif
    If nDialog = 4
        nTop    := 253
        nLeft   := 512
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
    Endif
    If nDialog = 5
        nTop    := 411
        nLeft   := 0
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
    Endif
    If nDialog = 6
        nTop    := 411
        nLeft   := 512
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
    Endif
    If nDialog = 7
        nTop    := 571
        nLeft   := 0
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
    Endif
    If nDialog = 8
        nTop    := 571
        nLeft   := 512
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
    Endif
   
        n:= ALLTRIM(STR( nDialog ))

    DEFINE DIALOG oDlg&n FROM nTop,nLeft to nBottom,nRight TITLE cTitle of oWndMain PIXEL  ;
                             COLOR RGB(0,0,0),RGB(208,221,230) ;
                             STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION) ;
                             TRANSPARENT
        @ 2,40  SAY "SPO2" of oDlg&n PIXEL SIZE 25,10 
        @ 2,150 SAY "HR"   of oDlg&n PIXEL SIZE 25,10 
        @ 10,5  SAY oSaySat&n VAR cSat&n FONT oFontBig PIXEL SIZE 82,37 UPDATE of oDlg&n
        @ 10,110 SAY oSayHR&n VAR cHR&n  FONT oFontBig PIXEL SIZE 82,37 UPDATE of oDlg&n
        @ 1.5,34 BUTTON oBtnInfo PROMPT "Pt. Info" of oDlg&n ACTION PatientInfo()
        @ 2.5,34 BUTTON oBtnQuit PROMPT "Close   " of oDlg&n ACTION oDlg&n:End() 
    ACTIVATE DIALOG oDlg&n NOWAIT 
    GetData(oDlg&n,n)
Return Nil

Function GetData(oDlg,n)
   Local lTest:=.t.
    Do while lTest := .t.
        for I = 1 TO 8
            C=aLLTRIM(STR(I)    )
            cSat&c := ALLTRIM(STR( ABS(HB_RandomInt( 85, 100 ) ) ) )
            cHR&c  := ALLTRIM(STR( ABS(HB_RandomInt( 75, 150 )  ) ) )
            TRY
                IF VAL(cSat&c) <= 88
                    oSaySat&c:SetColor( RGB(255,0,0),RGB(208,221,230))        
                ELSE
                    oSaySat&c:SetColor( RGB(0,0,0),RGB(208,221,230))        
                ENDIF
            CATCH
            END
        NEXT
        SysWait(1)
        For i = 1 to 8
            c:=alltrim( str( i ) )
             TRY
                     oDlg&c:Update()
             CATCH
             END
        Next
    ENDDO
Return Nil      

Function PatientInfo()
Return Nil
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Dialog Question
Posted: Sat Nov 06, 2010 09:04 PM
A quick Test with some changes :

The Values are stored in a Array.
Each Main-button defines a Array-element must be displayed inside the Dialog.
The Dialog shows different Array-Values, defined with the Mainwindow-buttons from < n >.



A Solution, You don't need a Close / exit-Button inside the Dialog.
A Mainbutton-click / change closes the Dialog-button.

1. define a Static var < lACTIVATED := .F. >, oDlg must be Static as well.
2. On Top of the Dialog set lACTIVATED to .T.
3. A click on any Mainbutton checks the Status lACTIVATED.
4. Include in each Mainbutton :
ACTION ( IIF( lACTIVATEED = .T., ( oDlg:End(), lACTIVATED := .F. ), NIL ), ;
A Button-click from any Mainbutton will close the opened Dialog ( because lACTIVATED = .T. )
and sets lACTIVATED to .F.
The opend Dialog sets lACTIVATED to .T. again.
With this Solution, You don't need to close the Dialog.

Code (fw): Select all Collapse
DEFINE WINDOW oWnd FROM  0,0 TO MaxRow(), MaxCol() TITLE "EzMon" COLOR RGB(0,0,0),RGB(255,255,255) 

@ 4,  30 BUTTON oBtn1 PROMPT "Activate Monitor 1" of oWnd SIZE 200,75 ACTION MakeDialog(oWnd,1)
@ 4, 100 BUTTON oBtn2 PROMPT "Activate Monitor 2" of oWnd SIZE 200,75 ACTION MakeDialog(oWnd,2)      
@ 12, 30 BUTTON oBtn3 PROMPT "Activate Monitor 3" of oWnd SIZE 200,75 ACTION MakeDialog(oWnd,3)
@ 12,100 BUTTON oBtn4 PROMPT "Activate Monitor 4" of oWnd SIZE 200,75 ACTION MakeDialog(oWnd,4)
@ 20, 30 BUTTON oBtn5 PROMPT "Activate Monitor 5" of oWnd SIZE 200,75 ACTION MakeDialog(oWnd,5)
@ 20,100 BUTTON oBtn6 PROMPT "Activate Monitor 6" of oWnd SIZE 200,75 ACTION MakeDialog(oWnd,6)
@ 28, 30 BUTTON oBtn7 PROMPT "Activate Monitor 7" of oWnd SIZE 200,75 ACTION MakeDialog(oWnd,7)
@ 28,100 BUTTON oBtn8 PROMPT "Activate Monitor 8" of oWnd SIZE 200,75 ACTION MakeDialog(oWnd,8)
   
ACTIVATE WINDOW oWnd MAXIMIZED  
 
RETURN ( NIL )

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

FUNCTION MakeDialog( oWnd, n )
Local oDlg, oSaySat, oSayHR, cSat[8], cHR[8]

cSat[1] := "1"
cSat[2] := "2"
cSat[3] := "3"
cSat[4] := "4"
cSat[5] := "5"
cSat[6] := "6"
cSat[7] := "7"
cSat[8] := "8"

cHR[1] := "A"
cHR[2] := "B"
cHR[3] := "C"
cHR[4] := "D"
cHR[5] := "E"
cHR[6] := "F"
cHR[7] := "G"
cHR[8] := "H"

DEFINE DIALOG oDlg FROM 0, 0 to 150, 600 TITLE "test" of oWnd PIXEL  ;
                             COLOR RGB(0,0,0),RGB(208,221,230) ;
                             STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION) ;
                             TRANSPARENT
@ 2,40  SAY "SPO2" of oDlg PIXEL SIZE 25,10 
@ 2,150 SAY "HR"   of oDlg PIXEL SIZE 25,10 
@ 10,5  SAY oSaySat VAR cSat[n] FONT oFont2 PIXEL SIZE 82,37 UPDATE of oDlg
@ 10,110 SAY oSayHR VAR cHR[n]  FONT oFont2 PIXEL SIZE 82,37 UPDATE of oDlg
@ 1.5,34 BUTTON oBtnInfo PROMPT "Pt. Info" of oDlg ACTION MsgAlert( "test", "attention" )
@ 2.5,34 BUTTON oBtnQuit PROMPT "Close   " of oDlg ACTION oDlg:End() 

ACTIVATE DIALOG oDlg NOWAIT

RETURN( NIL )


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Dialog Question
Posted: Sat Nov 06, 2010 09:37 PM

Jeff

the problem is... you never exit DO WHILE lTest

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Dialog Question
Posted: Sat Nov 06, 2010 09:57 PM

Hmmm..

If I exit the loop all dialogs stop adjusting the values of cSat and cHR .....

Dam .... I might need a separate GetData() for each dialog.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Dialog Question
Posted: Sat Nov 06, 2010 10:07 PM

Jeff

try with a timer one....

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Dialog Question
Posted: Sat Nov 06, 2010 11:05 PM
Hello Jeff

Your working Application ( some changes are needed ).
Simply Click a Button inside the Main-window to close and change a Monitor ( will break the loop ).



Code (fw): Select all Collapse
#include "fivewin.ch"

STATIC oDlg1, oDlg2

STATIC oWndMain, oFontBig
STATIC oDlg3, oDlg4, oDlg5, oDlg6, oDlg7, oDlg8
STATIC lACTIVATED 

Function Main()
Local oBtn1, oBtn2, oBtn3, oBtn4, oBtn5, oBtn6, oBtn7, oBtn8

PUBLIC cSat[8] //   cSat1, cSat2, cSat3, cSat4, cSat5, cSat6, cSat7, cSat8
PUBLIC cHR[8] //   cHR1, cHR2, cHR3, cHR4, cHR5, cHR6, cHR7, cHR8

DEFINE FONT oFontBig NAME "ARIAL" SIZE 50, 75 BOLD 
ACTIVATE FONT oFontBig

lACTIVATED := .F.
For i = 1 to 8
         c:= alltrim(str(i))
         cSat[i] := "---"
         cHR[i] := "---"
Next

DEFINE WINDOW oWndMain FROM  0,0 TO MaxRow(), MaxCol() TITLE "EzMon" COLOR RGB(0,0,0),RGB(255,255,255) MENU BuildMenu() //MDI //ICON "\EzSat\DLL\EzIcon2.ico"
MakeMainBar()   

@ 6,  30 BUTTON oBtn1 PROMPT "Activate Monitor 1" of oWndMain SIZE 200,75 ;
ACTION  ( IIF( lACTIVATED = .T., ( oDlg1:End(), lACTIVATED := .F. ), NIL ), MakeDialog(1) )

@ 6, 100 BUTTON oBtn2 PROMPT "Activate Monitor 2" of oWndMain SIZE 200,75 ;
ACTION  ( IIF( lACTIVATED = .T., ( oDlg1:End(), lACTIVATED := .F. ), NIL ), MakeDialog(2) )

@ 14, 30 BUTTON oBtn3 PROMPT "Activate Monitor 3" of oWndMain SIZE 200,75 ;
ACTION  ( IIF( lACTIVATED = .T., ( oDlg1:End(), lACTIVATED := .F. ), NIL ), MakeDialog(3) )

@ 14,100 BUTTON oBtn4 PROMPT "Activate Monitor 4" of oWndMain SIZE 200,75 ;
ACTION  ( IIF( lACTIVATED = .T., ( oDlg1:End(), lACTIVATED := .F. ), NIL ), MakeDialog(4) )

@ 22, 30 BUTTON oBtn5 PROMPT "Activate Monitor 5" of oWndMain SIZE 200,75 ;
ACTION  ( IIF( lACTIVATED = .T., ( oDlg1:End(), lACTIVATED := .F. ), NIL ), MakeDialog(5) )

@ 22,100 BUTTON oBtn6 PROMPT "Activate Monitor 6" of oWndMain SIZE 200,75 ;
ACTION  ( IIF( lACTIVATED = .T., ( oDlg1:End(), lACTIVATED := .F. ), NIL ), MakeDialog(6) )

@ 30, 30 BUTTON oBtn7 PROMPT "Activate Monitor 7" of oWndMain SIZE 200,75 ;
ACTION  ( IIF( lACTIVATED = .T., ( oDlg1:End(), lACTIVATED := .F. ), NIL ), MakeDialog(7) )

@ 30,100 BUTTON oBtn8 PROMPT "Activate Monitor 8" of oWndMain SIZE 200,75 ;
ACTION  ( IIF( lACTIVATED = .T., ( oDlg1:End(), lACTIVATED := .F. ), NIL ), MakeDialog(8) )

ACTIVATE WINDOW oWndMain MAXIMIZED VALID QuitApp() 

Return Nil

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

function BuildMenu()

MENU oMenu 2007
         MENUITEM "Exit" 
         MENU
            MENUITEM "Exit Program" ACTION QuitApp()  
         ENDMENU
ENDMENU

return oMenu

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

function quitapp()

dbcloseall()
set resources to
clear memory
ResAllFree()
Syswait(.5)
quit

return nil

Function MakeMainBar()

DEFINE BUTTONBAR oBar _3D SIZE 44, 46 OF oWndMain 2007  //36, 40

DEFINE BUTTON OF oBar FILE "\EzSat\Dll\Fix.bmp"  ;
MESSAGE "Message";
TOOLTIP "Tooltip";
ACTION MsgInfo() 

Return Nil

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

Function MakeDialog( nDialog )
LOCAL oSaySat, oSayHR, oBtnInfo, oBtnQuit
Local nTop, nBottom, nLeft, nRight, cTitle:="Monitor # "+ALLTRIM(str(nDialog))
Local nWide:= 506, nHigh:=127
Local n

lACTIVATED := .T.

If nDialog = 1
        nTop    := 93
        nLeft   := 0
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
Endif
If nDialog = 2
        nTop    := 93
        nLeft   := 512
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
Endif
If nDialog = 3
        nTop    := 253
        nLeft   := 0
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
Endif
If nDialog = 4
        nTop    := 253
        nLeft   := 512
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
Endif
If nDialog = 5
        nTop    := 411
        nLeft   := 0
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
Endif
If nDialog = 6
        nTop    := 411
        nLeft   := 512
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
Endif
If nDialog = 7
        nTop    := 571
        nLeft   := 0
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
Endif
If nDialog = 8
        nTop    := 571
        nLeft   := 512
        nBottom := nTop+nHigh
        nRight  := nLeft+nWide
Endif
   
// n := ALLTRIM(STR( nDialog ))

DEFINE DIALOG oDlg1 FROM nTop,nLeft to nBottom,nRight TITLE cTitle of oWndMain PIXEL  ;
                             COLOR RGB(0,0,0),RGB(208,221,230) ;
                             STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION) ;
                             TRANSPARENT

@ 2,40  SAY "SPO2" of oDlg1 PIXEL SIZE 25,10 
@ 2,150 SAY "HR"   of oDlg1 PIXEL SIZE 25,10 
@ 10,5  SAY oSaySat VAR cSat[nDialog] FONT oFontBig PIXEL SIZE 82,37 UPDATE of oDlg1
@ 10,110 SAY oSayHR VAR cHR[nDialog]  FONT oFontBig PIXEL SIZE 82,37 UPDATE of oDlg1
@ 1.5,34 BUTTON oBtnInfo PROMPT "Pt. Info" of oDlg1 ACTION PatientInfo()
//  @ 2.5,34 BUTTON oBtnQuit PROMPT "Close   " of oDlg1 ACTION oDlg1:End() 

ACTIVATE DIALOG oDlg1 NOWAIT ; 
ON PAINT GetData(oDlg1,n, oSaySat, oSayHR)

Return Nil

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

Function GetData(oDlg,n, oSaySat, oSayHR)
Local lTest:=.t.

Do while lTest := .t.
        FOR I = 1 TO 8
            // C=aLLTRIM(STR(I)    )
            cSat[i] := ALLTRIM(STR( ABS(HB_RandomInt( 85, 100 ) ) ) )
            cHR[i] := ALLTRIM(STR( ABS(HB_RandomInt( 75, 150 )  ) ) )
            TRY
                IF VAL(cSat[i]) <= 88
                    oSaySat:SetColor( RGB(255,0,0),RGB(208,221,230))        
                ELSE
                    oSaySat:SetColor( RGB(0,0,0),RGB(208,221,230))        
                ENDIF
            CATCH
            END
        NEXT
        SysWait(1)
//         For i = 1 to 8
//             c:=alltrim( str( i ) )
             TRY
                      oDlg:Update()
             CATCH
             END
//        Next
ENDDO

Return Nil      

Function PatientInfo()
Return Nil




Code (fw): Select all Collapse
Local nWide:= 506, nHigh:=157 // !!!! new Height

DEFINE DIALOG oDlg1 FROM nTop, nLeft to nBottom, nRight of oWndMain PIXEL  ; 
COLOR RGB(0,0,0),RGB(208,221,230) ;
STYLE nOr( WS_POPUP, WS_VISIBLE, WS_DLGFRAME, WS_THICKFRAME )  ;
TRANSPARENT

@ 0, 0 BITMAP oTITLE FILE "Colors.bmp" SIZE oDlg1:nWidth, 20 OF oDlg1 ADJUST
oTITLE:cTooltip := "Monitor Display"

oTITLE:bPainted := { |hDC| ;
DRAW_TITL1( oTITLE, ;       // BMP
  hDC, ;            // hDC
 .T., ;         // Horiz. or Vert.
 14853684, ;        // 1. Grad-Color
 16314573, ;        // 2. Grad-Color
 0.50, ;            // Color-Pos.
 oDlg1:nWidth, ;    // Title Width
 0, ;          // Text-Pos from left ( 0 = centered )
 oFont2, ;          // Font
 128, ;         // Font-Color
 cTitle ) }      

// !!!! new Rows

@ 30,40  SAY "SPO2" of oDlg1 PIXEL SIZE 25,10 
@ 30,150 SAY "HR"   of oDlg1 PIXEL SIZE 25,10 
@ 40,5  SAY oSaySat VAR cSat[nDialog] FONT oFontBig PIXEL SIZE 82,37 UPDATE of oDlg1
@ 40,110 SAY oSayHR VAR cHR[nDialog]  FONT oFontBig PIXEL SIZE 82,37 UPDATE of oDlg1
@ 1.5,34 BUTTON oBtnInfo PROMPT "Pt. Info" of oDlg1 ACTION PatientInfo()
...
...

//------------- Gradient / Color- TITLE-function  DIFFERENT from RESOURCE !!!! -----------

FUNCTION DRAW_TITL1( oBitmap, hDC, lDirect, nVColor, ;
          nBColor, nMove, nWidth, nLeft, oFont, nTColor, cTitle ) 

LOCAL aGrad := { { nMove, nVColor, nBColor }, { nMove, nBColor, nVColor } }
LOCAL oNewBrush, oBtn1

nBMPHIGHT := oBitmap:Super:nHeight() 
DEFINE BRUSH oNewBrush ;
COLOR GradientFill( hDC,  0, 0, nBMPHIGHT, nWidth, aGrad, lDirect )
hOldFont := SelectObject( hDC, oFont:hFont ) 
nTXTLG :=  GettextWidth( hDC, cTitle ) 
nFONTHIGHT := oFont:nInpHeight * -1 
IF nLEFT = 0
    nLEFT := (nWidth - nTXTLG) / 2  
ENDIF
nNEWHIGHT := nFONTHIGHT 
nTOP := (nBMPHIGHT - nNEWHIGHT) / 2 
SetTextColor( hDC,nTColor) 
SetBkMode( oBitmap:hDC, 0 ) 
TextOut( hDC, nTOP, nLEFT, cTitle ) 
RELEASE BRUSH oNewbrush

RETURN NIL


Best Regards
Uwe
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Dialog Question
Posted: Sun Nov 07, 2010 04:35 PM
Daniel,

I tested, using a Timer.
It works perfect !!!
That is my final Result ( any Backgrounds and BtnBmp ) :



Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Dialog Question
Posted: Sun Nov 07, 2010 06:01 PM

Hi Uwe / Daniel,

Thanks for all the help :)

Uwe,
It looks good :)

Could you please send me the code that you used in your final example.

Email: jeff (at) can-soft (dot) net

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Dialog Question
Posted: Tue Nov 09, 2010 12:39 AM
Hello Jeff,
maybe You prefer this Solution :

The same Function, but looks much better, changed from Dialog to VTitles !
As well it is a nice Example to show the convenient use of VTitles.
We can add Textshadows, a animated Monitor / Reflex , Action on Monitor-Symbol ( Info ) ...
There was a Problem, because a Vtitle covers the activated Button ( on Top ).
I had to hide the Button as long the Vtitle is visible and show the Button again, after a different Title is displayed.



Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Dialog Question
Posted: Tue Nov 09, 2010 01:28 PM

Hi Uwe,

That does look nice. I've not tried VTitles yet. Can you please send me this code as well so I can play around with it :)
It gives a nice clean look. Hiding the button is fine as I don't want them to be able to click it while the box is open.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Dialog Question
Posted: Tue Nov 09, 2010 05:37 PM
Hello jeff,

it will be the same Download-link, You got by Email.
I still have to add some Infotext to make it complete.
It will be finished in a short Time and I will send You a message.
You can test every Style, it is possible to create with VTitles.
Very easy to change the Style with many Infos, what to do.

Maybe these Screenshots gives You some Design-Ideas :





Best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Dialog Question
Posted: Tue Nov 09, 2010 10:12 PM
New Menu-positions added.
Now it is possible to select / paint : Colors, Brushes, Images and VTitle-Values.
The next Buttonclick shows the new Result ( no code-change needed, to test different Styles ) :

Transparent VTitle , NOBORDER and TEXTSHADOW selected
( shows : selected Button is hidden, with the activated VTitle )



Best Regards
uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion