DIALOG ON DIALOG

DIALOG ON DIALOG

Postby Silvio.Falconi » Mon May 06, 2013 5:53 pm

is possible make a dialog no caption into a dialog ?

I wish create it as this picture :

Image


I made this code but the dialog come to another position and not on the dialog

#include "FiveWin.ch"
#include "constant.ch"

Function test
Local odlg
Local nBottom := 16.5
Local nRight := 66
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H

Local odlg2,obtn

DEFINE DIALOG oDlg SIZE nWidth, nHeight TRANSPARENT PIXEL

@1,2 BUTTON obtn PROMPT "go" size 40,10 of oDlg ACTION Make_dlg2(oDlg)

ACTIVATE DIALOG oDlg CENTER

return nil


Function Make_dlg2(oDlg)
Local SuboDlg
DEFINE DIALOG SuboDlg OF oDlg
//SuboDlg:nStyle := nOR(WS_CAPTION , 4 )

ACTIVATE DIALOG SuboDlg
return nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6849
Joined: Thu Oct 18, 2012 7:17 pm

Re: DIALOG ON DIALOG

Postby Silvio.Falconi » Tue May 07, 2013 10:51 am

any help ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6849
Joined: Thu Oct 18, 2012 7:17 pm

Re: DIALOG ON DIALOG

Postby ukoenig » Tue May 07, 2013 12:26 pm

I needed the same, a var-edit from Main-dialog-values,
to be displayed with a Sub-dialog with a position from Top 50 and Left 50 of Maindialog :
You can change the Sub-dialog-styyle if needed.

NO title NO caption

STYLE nOr( WS_POPUP, WS_BORDER )

Image

Image

Code: Select all  Expand view

...
...
DEFINE DIALOG oGDialog FROM nDlgTop, nDlgLeft TO nDlgHeight, nDlgWidth  OF oWnd PIXEL ;
STYLE nOr( WS_CAPTION, WS_POPUP, WS_BORDER );
TITLE "Dialog GRADIENT"
...
...
@ oGDialog:nBottom - 150, oGDialog:nRight - 220  BTNBMP oBtn1 OF oGDialog PIXEL SIZE 30, 25 ;
NOBORDER 2007 ;
FILENAME c_path1 + "Write.Bmp" ;
ACTION TEST_DLG(oGDialog) ;
TOP
oBtn1:lTransparent := .t.  
oBtn1:cTooltip :=  { "EXIT the" + CRLF + "GRADIENT-dialog","EXIT GRADIENT-dialog", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 16777215, )

@ oGDialog:nBottom - 150, oGDialog:nRight - 150  BTNBMP oBtn2 OF oGDialog PIXEL SIZE 30, 25 ;
NOBORDER 2007 ;
FILENAME c_path1 + "Exit.Bmp" ;
ACTION ( lGDialog := .F., oGDialog:End() ) ;
TOP
oBtn2:lTransparent := .t.  
oBtn2:cTooltip :=  { "EXIT the" + CRLF + "GRADIENT-dialog","EXIT GRADIENT-dialog", 1, CLR_BLACK, 14089979 }
oBtn2:SetColor( 16777215, )

ACTIVATE DIALOG oGDialog  NOWAIT ;
ON INIT ( oBtn1:Move( oGDialog:nBottom - 150, oGDialog:nRight - 220, , , .f. ), ;
          oBtn2:Move( oGDialog:nBottom - 150, oGDialog:nRight - 150, , , .f. ) ) // Top, Bottom 3

RETURN NIL

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

FUNCTION TEST_DLG(oGDialog)
LOCAL oSubdlg, oBtn1, oBtn2, oBrush, oSay[6], oGet[6]

DEFINE BRUSH oBrush FILE c_path1 + "Marble.bmp"

DEFINE DIALOG oSubdlg FROM oGDialog:nTop + 50, oGDialog:nLeft + 50 TO 300, 450  OF oGDialog PIXEL ;
STYLE nOr( WS_CAPTION, WS_POPUP, WS_BORDER );
TITLE "Dialog-settings" BRUSH oBrush

@ 10, 10 SAY oSay[1] PROMPT "Top : " ;
OF oSubdlg SIZE 90, 20 FONT oFont3 PIXEL
oSay[1]:SetColor( 0, )
oSay[1]:lTransparent := .T.

@ 10, 45 GET oGet[1] VAR nDlgLeft OF oSubdlg SIZE 30, 10 PICTURE "9999" FONT oFont3 RIGHT PIXEL UPDATE

@ 30, 10 SAY oSay[2] PROMPT "Left : " ;
OF oSubdlg SIZE 90, 20 FONT oFont3 PIXEL
oSay[2]:SetColor( 0, )
oSay[2]:lTransparent := .T.

@ 30, 45 GET oGet[2] VAR nDlgTop OF oSubdlg SIZE 30, 10 PICTURE "9999" FONT oFont3 RIGHT PIXEL UPDATE

@ 50, 10 SAY oSay[3] PROMPT "Bottom : " ;
OF oSubdlg SIZE 90, 20 FONT oFont3 PIXEL
oSay[3]:SetColor( 0, )
oSay[3]:lTransparent := .T.

@ 50,45 GET oGet[3] VAR nDlgHeight OF oSubdlg SIZE 30, 10 PICTURE "9999" FONT oFont3 RIGHT PIXEL UPDATE

@ 70, 10 SAY oSay[4] PROMPT "Right : " ;
OF oSubdlg SIZE 90, 20 FONT oFont3 PIXEL
oSay[4]:SetColor( 0, )
oSay[4]:lTransparent := .T.

@ 70, 45 GET oGet[4] VAR nDlgWidth OF oSubdlg SIZE 30, 10 PICTURE "9999" FONT oFont3 RIGHT PIXEL UPDATE

@ oSubdlg:nBottom - 150, oSubdlg:nRight - 190  BTNBMP oBtn1 OF oSubdlg PIXEL SIZE 30, 25 ;
NOBORDER 2007 ;
FILENAME c_path1 + "Save.Bmp" ;
ACTION oSubdlg:End() ;
TOP
oBtn1:lTransparent := .t.  
oBtn1:cTooltip :=  { "EXIT the" + CRLF + "Sub-Dialog","EXIT Sub-dialog", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 16777215, )

@ oSubdlg:nBottom - 150, oSubdlg:nRight - 120  BTNBMP oBtn2 OF oSubdlg PIXEL SIZE 30, 25 ;
NOBORDER 2007 ;
FILENAME c_path1 + "Exit.Bmp" ;
ACTION oSubdlg:End() ;
TOP
oBtn2:lTransparent := .t.  
oBtn2:cTooltip :=  { "EXIT the" + CRLF + "Sub-Dialog","EXIT Sub-dialog", 1, CLR_BLACK, 14089979 }
oBtn2:SetColor( 16777215, )

ACTIVATE DIALOG oSubdlg  ;
ON INIT ( oBtn2:Move( oSubdlg:nBottom - 120, oSubdlg:nRight - 120, , , .f. ), ;
              oBtn1:Move( oSubdlg:nBottom - 120, oSubdlg:nRight - 190, , , .f. ) )

oBrush:End()

RETURN NIL
 


Best Regards
Uwe :lol:
Last edited by ukoenig on Tue May 07, 2013 5:55 pm, edited 3 times in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: DIALOG ON DIALOG

Postby cnavarro » Tue May 07, 2013 2:23 pm

Silvio.Falconi wrote:any help ?


Esto funciona bien

This works well

Code: Select all  Expand view

#include "FiveWin.ch"
#include "constant.ch"

Function main
Local odlg
Local nBottom := 16.5
Local nRight := 66
Local nWidth := Max( nRight * DLG_CHARPIX_W, 280 )
Local nHeight := nBottom * DLG_CHARPIX_H + 80

Local odlg2,obtn

DEFINE DIALOG oDlg SIZE nWidth, nHeight TRANSPARENT PIXEL
@ 1,2 BUTTON obtn PROMPT "go" size 40,10 of oDlg ACTION Make_dlg2( oDlg )
ACTIVATE DIALOG oDlg CENTER

return nil


Function Make_dlg2(oDlg)
Local SuboDlg
DEFINE DIALOG SuboDlg OF oDlg TRANSPARENT
SuboDlg:nStyle -= WS_CAPTION //nOR(WS_CAPTION , 4 )
SuboDlg:nStyle += WS_CHILD
//SuboDlg:nStyle += WS_CLIPCHILDREN

@ 4,4 SAY "Dialog" OF SuboDlg

ACTIVATE DIALOG SuboDlg NOMODAL ON INIT ( ;
                SETPARENT( SuboDlg:hWnd , oDlg:hWnd ),;
                SuboDlg:Move( 18 , 260 , 226, 300 , .T. ))
return nil
 


Saludos

Regards
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: DIALOG ON DIALOG

Postby ukoenig » Tue May 07, 2013 3:50 pm

Cristobal Navarro,

that will not work, because of controls from Main-dialog :

Image

Your extended sample :
Code: Select all  Expand view


#include "FiveWin.ch"
#include "constant.ch

STATIC c_path , c_path1

Function main
Local odlg
Local nBottom := 16.5
Local nRight := 66
Local nWidth := Max( nRight * DLG_CHARPIX_W, 280 )
Local nHeight := nBottom * DLG_CHARPIX_H + 80

Local odlg2,obtn, oFont1, oSay1, oSay2

c_path := cFilePath(GetModuleFileName( GetInstance() ) )
c_path1 := c_path + "
IMAGES\"

oFont1 := TFont():New("
Arial",0,-40,.F.,.T.,0,0,0,.F. )

DEFINE DIALOG oDlg SIZE nWidth, nHeight  PIXEL

@ 50, 50 BUTTON obtn PROMPT "
go" size 40,10 of oDlg PIXEL ;
ACTION Make_dlg2( oDlg, oFont1 )

@ 70, 20 SAY oSay1 PROMPT "
Main-Dialog" SIZE 130, 30  OF oDlg PIXEL FONT oFont1
oSay1:lTransparent := .T.
oSay1:SetColor( 255, )

@ 100, 40 SAY oSay2 PROMPT "
Main-Dialog" SIZE 130, 30  OF oDlg PIXEL FONT oFont1
oSay2:lTransparent := .T.
oSay2:SetColor( 16443068, )

ACTIVATE DIALOG oDlg CENTER ;
ON INIT ( D_BACKGRD( oDlg, 1, 16744448 ) )

oFont1:End()

return nil

// -----

Function Make_dlg2(oDlg,oFont1)
Local SuboDlg, oSay1
DEFINE DIALOG SuboDlg OF oDlg PIXEL // TRANSPARENT
SuboDlg:nStyle -= WS_CAPTION //nOR(WS_CAPTION , 4 )
SuboDlg:nStyle += WS_CHILD
//SuboDlg:nStyle += WS_CLIPCHILDREN

@ 20, 10 SAY oSay1 PROMPT "
Sub-Dlg." SIZE 130, 30  OF SuboDlg PIXEL FONT oFont1
oSay1:lTransparent := .T.
oSay1:SetColor( 16443068, )

ACTIVATE DIALOG SuboDlg NOMODAL ;
ON INIT ( SETPARENT( SuboDlg:hWnd , oDlg:hWnd ),;
                  SuboDlg:Move( 18 , 260 , 226, 300 , .T. ), ;
          D_BACKGRD( SuboDlg, 1, 255 ) )

return nil

// --------  WINDOW / DIALOG - Background ---------------

FUNCTION D_BACKGRD( oDlg, nStyle, nColor1, nColor2, nMove, lDirect, cBrush, cImage )
LOCAL oBrush, hDC, aGrad, oImage
LOCAL aRect := GETCLIENTRECT( oDlg:hWnd )

IF nStyle = 1 // COLOR
    DEFINE BRUSH oBrush COLOR nColor1
    oDlg:SetBrush( oBrush )
    oBrush:End()
ENDIF
IF nStyle = 2 // GRADIENT Brush
    aGrad := { { nMove, nColor1, nColor2 }, { nMove, nColor2, nColor1 } }
    hDC = CreateCompatibleDC( oDlg:GetDC() )
    hBmp = CreateCompatibleBitMap( oDlg:hDC, oDlg:nWidth, oDlg:nHeight )
    hBmpOld = SelectObject( hDC, hBmp )
    GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aGrad, lDirect ) // .T: = Vertical
    DeleteObject( oDlg:oBrush:hBrush )
    oBrush := TBrush():New( ,,,, hBmp )
    oBrush:Cargo  := aGrad
    SelectObject( hDC, hBmpOld )
    ReleaseDC(hDC)
    oDlg:SetBrush( oBrush )
    oBrush:End()
ENDIF
IF nStyle = 3 // BMP-BRUSH
    DEFINE BRUSH oBrush FILE c_path1 + cBrush
    oDlg:SetBrush( oBrush )
    oBrush:End()
ENDIF
IF nStyle = 4 // Image ADJUSTED
    IF FILE( c_path1 + cImage )
        DEFINE IMAGE oImage FILE c_path1 + cImage
        oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap,  aRect[4], aRect[3], .T. ) )
        oImage:End()
        oDlg:SetBrush( oBrush )
        oBrush:End()
    ELSE
        IF !EMPTY(cImage)
            MsgAlert( "
File : " + cImage + CRLF + ;
                    "
does not exist" + CRLF + ;
                        "
to show Image !", "ATTENTION" )
        ENDIF
    ENDIF
ENDIF

RETURN( NIL )


Best Regards
Uwe :cry:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: DIALOG ON DIALOG

Postby Silvio.Falconi » Tue May 07, 2013 7:48 pm

on subdlg I must insert a button as :


DEFINE DIALOG SuboDlg OF oDlg TRANSPARENT
SuboDlg:nStyle -= WS_CAPTION //nOR(WS_CAPTION , 4 )
SuboDlg:nStyle += WS_CHILD


@ 5,8 BUTTON obtnok PROMPT "&Ritorna" OF SuboDlg ;
FONT oFont SIZE 40, 10 ACTION ( SuboDlg:end( IDOK ) )

ACTIVATE DIALOG SuboDlg NOMODAL ON INIT (oGetNum:nHeight:=21.4, ;
SETPARENT( SuboDlg:hWnd , oDlg:hWnd ),;
SuboDlg:Move( 10 , 260 , 250, 215 , .T. ))

because I must make a control on End

if SuboDlg:nresult == IDOK
.....
endif


But it not run because let me error on if SuboDlg:nresult == IDOK
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6849
Joined: Thu Oct 18, 2012 7:17 pm

Re: DIALOG ON DIALOG

Postby cnavarro » Tue May 07, 2013 7:59 pm

Puedes adjuntar algo mas de tu codigo?
No entiendo bien lo que quieres hacer.

Saludos

You can attach your code some more?
I do not understand what you want to do.

regards
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: DIALOG ON DIALOG

Postby Silvio.Falconi » Tue May 07, 2013 9:16 pm

Ok Now I explain you :

I wish add % percentual math control to msgcalc (it there is on msgcalc but I wish add different calculation)



I wish add calculation, incremental and decremental I need it to calculate Tax on a price


First
I first I made a function to change the size of dialog called allarge(oDlg,ntipo)

nTipo can be 1 to second dlg size and 2 to return to first size

when I have the msgcalc I have :

Image

when I call the percentual I have : (it call allarge(oDlg,1) and made subdialog

Image



on this subdialog I insert some controls
Tipo := 1
PorCien := 0

@ 0.2, 2 SAY cPercentual OF SuboDlg SIZE 200,40 FONT oFont TRANSPARENT

@ 1.4,2 GET oGetNum VAR Porcien PICTURE "99.99" SPINNER OF SuboDlg SIZE 40,4

@ 4, 2 RADIO oRad VAR Tipo OF SuboDlg ;
PROMPT cCalculate, cIncremental ,cDecremental SIZE 100,12

@ 5,8 BUTTON obtnok PROMPT "OK" OF SuboDlg ;
FONT oFont SIZE 40, 10 ACTION ( SuboDlg:end( IDOK ) )//,lSave:=.t. ) oGetNum:nHeight:=21.4


if the user press OK the procedure must make a calculation :

if SuboDlg:nresult == IDOK


DO CASE
CASE Tipo == 1
Display := ( nMemo ) * ( PorCien / 100 )
CASE Tipo == 2
Display := (nMemo ) * ( 1 + ( PorCien / 100 ) )
CASE Tipo == 3
Display := ( nMemo ) / ( 1 + ( PorCien / 100 ) )
ENDCASE

nMemo := Display
oGet:cText( Space(18)+Transform( nMemo , cPict ))

oDlg:Update() // update the msgcalc dialog


Endif

Allarge(oDlg,1) // return to first size dialog

return NIL
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6849
Joined: Thu Oct 18, 2012 7:17 pm

Re: DIALOG ON DIALOG

Postby cnavarro » Tue May 07, 2013 10:02 pm

Buenas noches

Es posible que este código te pueda servir

good night

It is possible that you can serve this code

Code: Select all  Expand view

#include "FiveWin.ch"
#include "constant.ch"

Function main
Local odlg
Local nBottom := 16.5
Local nRight := 66
Local nWidth := Max( nRight * DLG_CHARPIX_W, 280 )
Local nHeight := nBottom * DLG_CHARPIX_H + 80

Local odlg2,obtn
Local lSw

DEFINE DIALOG oDlg SIZE nWidth, nHeight TRANSPARENT PIXEL

@ 1,2 BUTTON obtn PROMPT "go" size 40,10 of oDlg ;
      ACTION  lSw := Make_dlg2( oDlg )

ACTIVATE DIALOG oDlg CENTER

return nil


Function Make_dlg2( oDlg )
Local SuboDlg
Local obtnok
Local lSw1   := .F.

DEFINE DIALOG SuboDlg OF oDlg TRANSPARENT
SuboDlg:nStyle -= WS_CAPTION //nOR(WS_CAPTION , 4 )
SuboDlg:nStyle += WS_CHILD
//SuboDlg:nStyle += WS_CLIPCHILDREN

@ 4,4 BUTTON obtnok PROMPT "&Ritorna" OF SuboDlg ;
      SIZE 40, 10 ACTION ( lSw1 := .T. , SuboDlg:end( IDOK ) )
//@ 4,4 SAY "Dialog" OF SuboDlg

ACTIVATE DIALOG SuboDlg NOMODAL ON INIT ( ;
                SETPARENT( SuboDlg:hWnd , oDlg:hWnd ),;
                SuboDlg:Move( 18 , 260 , 226, 300 , .T. )) ;
                VALID ( Ritorna( SuboDlg, lSw1 ),  .T. )

return lSw1

function Ritorna( SuboDlg, lSw )

// Resto de acciones
MsgInfo( lSw )
   
Return lSw

 


Un saludo
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Enrico Maria Giordano and 30 guests