FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour a dialog ws_child
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
a dialog ws_child
Posted: Fri Dec 20, 2013 08:13 AM
I wish create a WS_CHILD DIALOG into a folder at bottom
I need it to create a small dialog into the bottom of the first folder to ask to final user a value and then end the ws_child dialog
but it not run ok
here a minimal test to try

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

Function Main()
   Local oFrmInvoice
   Local oFld
   Local  nBottom   := 35
   Local  nRight    := 110
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H

DEFINE DIALOG oFrmInvoice  TITLE "test" ;
 SIZE nWidth, nHeight   PIXEL

 @ 25, 3 FOLDER oFld OF oFrmInvoice SIZE 100, 100 PIXEL  ;
     PROMPT "Righe documento","Pagamento","Note","Indirizzi","Opzione"

ACTIVATE DIALOG oFrmInvoice CENTER ON INIT  Test2(oFrmInvoice,oFld)
RETURN NIL


Function Test2(oFrmInvoice,oFld)
        Local  nBottom   := 20
        Local  nRight    := 99
        Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
        Local nHeight := nBottom * DLG_CHARPIX_H
        Local oDlgBarra
       DEFINE DIALOG oDlgBarra OF oFld:adialogs[1]  STYLE WS_CHILD ;
         FROM 20, 10 TO 10,10 PIXEL
        // @
        ACTIVATE  DIALOG oDlgBarra
Retur Nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: a dialog ws_child
Posted: Fri Dec 20, 2013 09:33 AM
Code (fw): Select all Collapse
xHarbour 1.2.3 Intl. (SimpLex) (Build 20131030)
Copyright 1999-2013, http://www.xharbour.org <!-- m --><a class="postlink" href="http://www.harbour-project.org/">http://www.harbour-project.org/</a><!-- m -->
SILVIO.prg(34) Warning W0003  Variable: 'OFRMINVOICE' declared but not used in function: 'TEST2(23)'
SILVIO.prg(34) Warning W0032  Variable 'NWIDTH' is assigned but not used in function 'TEST2(26)'
SILVIO.prg(34) Warning W0032  Variable 'NHEIGHT' is assigned but not used in function 'TEST2(27)'


Please correct and resend.

EMG
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: a dialog ws_child
Posted: Fri Dec 20, 2013 09:37 AM
Sorry Emg,

compilato con W2

------------------------------------------------------------------------------------------------------
Progetto: test, Ambiente: xFive_Pelles:
[1]:Harbour.Exe test.prg /m /n0 /gc1 /w2 /es2 /iC:\work\fwh\include /ic:\work\xHarbour\Include /iinclude;c:\work\fwh\include;c:\work\xHarbour\include /oObj\test.c
xHarbour 1.2.3 Intl. (SimpLex) (Build 20130422)
Copyright 1999-2013, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'test.prg'...
Generating C source output to 'Obj\test.c'...
Done.
-------------------------------------------------------------------------------------------------------------------





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

Function Main()
Local oFrmInvoice
Local oFld
Local nBottom := 35
Local nRight := 110
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H

DEFINE DIALOG oFrmInvoice TITLE "test" ;
SIZE nWidth, nHeight PIXEL

@ 25, 3 FOLDER oFld OF oFrmInvoice SIZE 200, 200 PIXEL ;
PROMPT "Test"
 @ 2,0 Button  "test" SIZE 80,10  OF ofld:adialogs[1] Action Test2(oFld)
ACTIVATE DIALOG oFrmInvoice CENTER
*ON INIT Test2(oFld)

RETURN NIL

Function Test2(oFld)
   Local oDlgBarra
   Local aGet[1]
   Local oBtnIns
   Local cArticolo:=space(30)

DEFINE DIALOG oDlgBarra OF oFld:adialogs[1] ;
FROM 20, 10 TO 50,300 PIXEL   STYLE WS_CHILD

        @ 2,2  SAY "Codice a Barra :" SIZE 80,12  PIXEL OF oDlgBarra
        @ 2,40 GET aGet[1]  var cArticolo SIZE 80,10  PIXEL OF oDlgBarra
        @ 1,120 BUTTON oBtnIns Prompt "vai" SIZE 10,10  PIXEL OF oDlgBarra

        ACTIVATE DIALOG oDlgBarra CENTER

RETURN NIL




Press the button
I wish create the dialog oDlgBarra at the end of the first folder ...
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: a dialog ws_child
Posted: Fri Dec 20, 2013 11:28 AM
Silvio, please try using

Code (fw): Select all Collapse
STYLE WS_POPUP


EMG
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: a dialog ws_child
Posted: Fri Dec 20, 2013 11:42 AM
allready tried !!!
the dialog is eith no caption but the dialog not is into first folder

To make a small test just an idea
If you tried to insert this line
Local oFld1
@ 11,1 FOLDER oFld1 OF oFld:adialogs[1] PROMPT "" size 180,20
it create a folder into the first folder at the exactly x,y I wish the dialog
why the folder is created and the dialog not ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: a dialog ws_child
Posted: Fri Dec 20, 2013 03:06 PM
Silvio,

the solution, You are looking for ?
As long the dialog is open and You change to folderpages 2 or 3,
on page 1 the dialog is still visible until You close it with the button.
Dialog-NOWAIT is used, to make it possible, to edit the 2 gets.

Define the dialog like :

DEFINE DIALOG oDlgBarra OF oFld:adialogs[1] ;
FROM 0, 0 TO 30, 310 PIXEL ;
STYLE nOR( DS_MODALFRAME | WS_POPUP | WS_DLGFRAME | WS_THICKFRAME )
...
...
ACTIVATE DIALOG oDlgBarra NOWAIT ;
ON INIT oDlgBarra:Move( oFld:nTop + 450, oFld:nLeft + 110, , , .T. )




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

STATIC oDlgBarra, lOpen := .F.

Function Main()
Local oFrmInvoice
Local oFld
Local nBottom := 35
Local nRight := 110
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
Local oFont, oBrush1, oBrush2, oBrush3
LOCAL c_path, c_path1, aBitmaps, oDGet1, oDGet2, cTest1 := SPACE(20), cTest2 := SPACE(20)

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

aBitmaps := { c_path1 + "Image.Bmp",;
                          c_path1 + "Image.bmp",;
                          c_path1 + "Exit1.bmp" }

lActive := .F.

DEFINE BRUSH oBrush1  GRADIENT { { 0.50, 16710607, 16759929 }, { 0.50, 16759929, 16710607 } }
DEFINE BRUSH oBrush2 GRADIENT { { 1, 16710607, 16759929 } }
DEFINE BRUSH oBrush3 GRADIENT { { 1, 16759929, 16710607 } }

oFont  := TFont():New("Arial",,-14,.F.,.F. ,,,,.F. )

DEFINE DIALOG oFrmInvoice TITLE "test" SIZE nWidth, nHeight PIXEL BRUSH oBrush2

@ 25, 3 FOLDEREX SIZE 200, 200 oFld PIXEL ADJUST ROUND 5 UPDATE ;
PROMPT  "Page &1", "Page &2", "&EXIT" OF oFrmInvoice ;
BITMAPS aBitmaps;
ON PAINT TAB PaintTab( Self, nOption );
ON CHANGE ( nSavePage := oFld:nOption, ;
                            IF( nOption == 1 .and. lOpen == .T., TEST2(oFld), ), ;                         
                            IF( nOption > 1 .and. lOpen == .T., oDlgBarra:End(), ), ;                         
                            IF( nOption == 3, If( MsgYesNo( "Do you want exit??" ), ;
                                                               oFrmInvoice:End(), ( ::SetOption( nOldOption ), ::Refresh() ) ), ) ) ;                         
ON PAINT TEXT( If( nOption == ::nOption .and. nOption == 2, 8388608, 0 ) );
TOP OPTION 1 ALIGN 0, 0, 0 

 oFld:lTransparent := .T.
oFld:nFolderHeight := 25
oFld:nSeparator := 2
oFld:bClrText := {| o, n | 128 }
oFld:oFont := oFont
oFld:nOption := 1

oFld:aDialogs[ 1 ]:SetBrush( oBrush1 )
oFld:aDialogs[ 2 ]:SetBrush( oBrush2 )
oFld:aDialogs[ 3 ]:SetBrush( oBrush3 )

@ 90,55 GET oDGet1  var cTest1 SIZE 80,10  PIXEL OF oFld:adialogs[1]
@ 110,55 GET oDGet2  var cTest2 SIZE 80,10  PIXEL OF oFld:adialogs[1]

@ 2,0 Button  "Dialog" SIZE 80,10  OF oFld:adialogs[1] ;
Action ( lOpen := .T., Test2(oFld) )

ACTIVATE DIALOG oFrmInvoice CENTER

RELEASE BRUSH oBrush1, oBrush2, oBrush3, oFont

RETURN NIL

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

FUNCTION PaintTab( o, nOption )

IF nOption == o:nOver .OR. nOption == o:nOption
      o:SetAlphaLevel( nOption, 255 )
ELSE 
      o:SetAlphaLevel( nOption, 50 )
ENDIF 
   
RETURN o:SetFldColors( o, nOption )    

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

FUNCTION TEST2(oFld)
Local aGet[1]
Local oBtnIns
Local cArticolo:=space(30)

DEFINE DIALOG oDlgBarra OF oFld:adialogs[1] ;
FROM 0, 0 TO 30, 310 PIXEL ;
STYLE nOR( DS_MODALFRAME | WS_POPUP | WS_DLGFRAME | WS_THICKFRAME )

@ 2,2  SAY "Codice a Barra :" SIZE 80,12  PIXEL OF oDlgBarra
@ 2,55 GET aGet[1]  var cArticolo SIZE 80,10  PIXEL OF oDlgBarra

@ 1,135 BUTTON oBtnIns Prompt "close" SIZE 18,10  PIXEL OF oDlgBarra ;
ACTION ( lOpen := .F., oDlgBarra:End() )

ACTIVATE DIALOG oDlgBarra NOWAIT ; 
ON INIT oDlgBarra:Move( oFld:nTop + 450, oFld:nLeft + 110, , , .T. )

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: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: a dialog ws_child
Posted: Thu Dec 26, 2013 05:17 PM
Uwe,
on my screen the dialog is not on first folder but on the left far from the main window

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: a dialog ws_child
Posted: Thu Dec 26, 2013 08:31 PM
Silvio,

some more tests and changes ( included a main-window ) :

Download : http://www.pflegeplus.com/fw_downloads/fldtest1.zip



Maybe using SHOW and HIDE is a better solution ?



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

Function Main()
Local oFrmInvoice
Local oWnd, oFld, oBtn1, oBtn2
Local nBottom := 35
Local nRight := 110
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
Local oFont, oBrush1, oBrush2, oBrush3
LOCAL c_path, c_path1, aBitmaps
LOCAL oDGet1, oDGet2, oDGet3, cTest1 := SPACE(20), cTest2 := SPACE(20), cTest3 := SPACE(20)

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

aBitmaps := { c_path1 + "Preview.Bmp",;
                          c_path1 + "Preview.bmp",;
                          c_path1 + "Exit1.bmp" }

DEFINE BRUSH oBrush1  GRADIENT { { 0.50, 16710607, 16759929 }, { 0.50, 16759929, 16710607 } }
DEFINE BRUSH oBrush2 GRADIENT { { 1, 16710607, 16759929 } }
DEFINE BRUSH oBrush3 GRADIENT { { 1, 16759929, 16710607 } }

oFont  := TFont():New("Arial",,-14,.F.,.F. ,,,,.F. )

DEFINE WINDOW oWnd TITLE "Foldertest FWH-version => "  + FWVERSION  BRUSH oBrush1

DEFINE DIALOG oFrmInvoice TITLE "Test folder" SIZE nWidth, nHeight PIXEL OF oWnd BRUSH oBrush2

@ 15, 10 FOLDEREX SIZE 180, 160 oFld PIXEL ROUND 5 UPDATE ;
PROMPT  "Page &1", "Page &2", "&EXIT" OF oFrmInvoice ;
BITMAPS aBitmaps;
ON PAINT TAB PaintTab( Self, nOption );
ON CHANGE ( nSavePage := oFld:nOption, ;
                            IF( nOption == 3, If( MsgYesNo( "Do you want exit??" ), ;
                                                                oWnd:End(), ( ::SetOption( nOldOption ), ::Refresh() ) ), ) ) ;                         
ON PAINT TEXT( If( nOption == ::nOption .and. nOption == 2, 8388608, 0 ) );
TOP OPTION 1 ALIGN 0, 0, 0 

 oFld:lTransparent := .T.
oFld:nFolderHeight := 40
oFld:nSeparator := 2
oFld:bClrText := {| o, n | 128 }
oFld:oFont := oFont
oFld:nOption := 1

oFld:aDialogs[ 1 ]:SetBrush( oBrush1 )
oFld:aDialogs[ 2 ]:SetBrush( oBrush2 )
oFld:aDialogs[ 3 ]:SetBrush( oBrush3 )

@ 20,0 Button  oBtn1 PROMPT "Value" SIZE 80,10  OF oFld:adialogs[1] PIXEL ;
Action ( oBtn2:Show(), oDGet3:Show() ) // Test2(oFrmInvoice, oFld) )

@ 70,55 GET oDGet1  var cTest1 SIZE 80,10  PIXEL OF oFld:adialogs[1]
@ 85,55 GET oDGet2  var cTest2 SIZE 80,10  PIXEL OF oFld:adialogs[1]

@ 115,135 Button  oBtn2 PROMPT "Close" SIZE 20,10  OF oFld:adialogs[1] PIXEL ;
Action ( oBtn2:Hide(), oDGet3:Hide() ) // Test2(oFrmInvoice, oFld) )

@ 115,55 GET oDGet3  var cTest3 SIZE 80,10  PIXEL OF oFld:adialogs[1]

ACTIVATE DIALOG oFrmInvoice NOWAIT CENTER ;
ON INIT ( oFrmInvoice:Move( oWnd:nBottom - 150, oWnd:nRight - 120, 400, 420, .f. ), ;
                 oBtn2:Hide(), oDGet3:Hide() )

ACTIVATE WINDOW oWnd MAXIMIZED 

RELEASE BRUSH oBrush1, oBrush2, oBrush3, oFont

RETURN NIL


Another solution :



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

STATIC oFont

Function Main()
Local oFrmInvoice
Local oWnd, oFld, oBtn1, oBtn2
Local nBottom := 35
Local nRight := 110
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
Local oFont, oBrush1, oBrush2, oBrush3
Local c_path, c_path1, aBitmaps, oDGet1, oDGet2, oDGet3, cTest1 := SPACE(20), cTest2 := SPACE(20)

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

aBitmaps := { c_path1 + "Preview.Bmp",;
                          c_path1 + "Preview.bmp",;
                          c_path1 + "Exit1.bmp" }

oFont  := TFont():New("Arial",,-14,.F.,.T. ,,,,.F. )

DEFINE BRUSH oBrush1  GRADIENT { { 0.50, 16710607, 16759929 }, { 0.50, 16759929, 16710607 } }
DEFINE BRUSH oBrush2 GRADIENT { { 1, 16710607, 16759929 } }
DEFINE BRUSH oBrush3 GRADIENT { { 1, 16759929, 16710607 } }

oFont  := TFont():New("Arial",,-14,.F.,.F. ,,,,.F. )

DEFINE WINDOW oWnd TITLE "Foldertest FWH-version => "  + FWVERSION  BRUSH oBrush1

DEFINE DIALOG oFrmInvoice TITLE "Test folder" SIZE nWidth, nHeight PIXEL OF oWnd BRUSH oBrush2

@ 15, 10 FOLDEREX SIZE 180, 160 oFld PIXEL ROUND 5 UPDATE ;
PROMPT  "Page &1", "Page &2", "&EXIT" OF oFrmInvoice ;
BITMAPS aBitmaps;
ON PAINT TAB PaintTab( Self, nOption );
ON CHANGE ( nSavePage := oFld:nOption, ;
                            IF( nOption == 3, If( MsgYesNo( "Do you want exit??" ), ;
                                                                oWnd:End(), ( ::SetOption( nOldOption ), ::Refresh() ) ), ) ) ;                         
ON PAINT TEXT( If( nOption == ::nOption .and. nOption == 2, 8388608, 0 ) );
TOP OPTION 1 ALIGN 0, 0, 0 

 oFld:lTransparent := .T.
oFld:nFolderHeight := 40
oFld:nSeparator := 2
oFld:bClrText := {| o, n | 128 }
oFld:oFont := oFont
oFld:nOption := 1

oFld:aDialogs[ 1 ]:SetBrush( oBrush1 )
oFld:aDialogs[ 2 ]:SetBrush( oBrush2 )
oFld:aDialogs[ 3 ]:SetBrush( oBrush3 )

@ 20,0 Button  oBtn1 PROMPT "Edit Value" SIZE 80,10  OF oFld:adialogs[1] PIXEL ;
Action SHOW_MSG(oFld, c_Path1)

@ 50,55 GET oDGet1  var cTest1 SIZE 80,10  PIXEL OF oFld:adialogs[1]
@ 65,55 GET oDGet2  var cTest2 SIZE 80,10  PIXEL OF oFld:adialogs[1]

ACTIVATE DIALOG oFrmInvoice NOWAIT CENTER ;
ON INIT  oFrmInvoice:Move( oWnd:nBottom - 150, oWnd:nRight - 120, 400, 420, .f. )

ACTIVATE WINDOW oWnd MAXIMIZED 

RELEASE BRUSH oBrush1, oBrush2, oBrush3, oFont

RETURN NIL

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

FUNCTION SHOW_MSG(oFld, c_Path1)
LOCAL oTitle, oBtn, oGet, cTest := SPACE(20), oText, oImg

@  180, 100 TITLE oTitle SIZE 180, 70 OF oFld:adialogs[1]  ; // Width, Height
BORDER SHADOW BOTTOMRIGHT SHADOWSIZE 10  PIXEL
oTitle:aGrdBack := { { 0.1, 16443068, 10899511 },{ 0.1, 10899511, 16443068 } }
oTitle:lRound := .T.

@ 10, 20  TITLETEXT oText OF oTitle TEXT "Select : "  FONT oFont ;
COLOR 11075583

@ 30, 20 GET oGet  var cTest SIZE 120, 20  PIXEL OF oTitle

@  30, 140 TITLEIMG OF oTitle BITMAP c_Path1 + "Exit1.bmp" SIZE 24, 24 ANIMA ;
ACTION oTitle:End() 

RETURN NIL

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

FUNCTION PaintTab( o, nOption )

IF nOption == o:nOver .OR. nOption == o:nOption
      o:SetAlphaLevel( nOption, 255 )
ELSE 
      o:SetAlphaLevel( nOption, 50 )
ENDIF 
   
RETURN o:SetFldColors( o, nOption )


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: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: a dialog ws_child
Posted: Sun Dec 29, 2013 06:06 PM
Uwe,
I Have a dialog with folder and on first folder I use a xbrowse





When i must insert a product with barcode I must show a get at the bottom og the xbrowse
when I make this operation I change the height of the xbrowse and at the bottom I show the get
the function must save the value od the barcode products to insert it on xbrowse







When the user press the button I hide the get and
then I rechange the xbrowse and refresh the folder




On the pics you can see I use only a get with a button but I must save the value the user insert
when I create that get and that button I cannot stop the other commands on the dialog
the user must only insert the value of barcode and he must not press any button

then I thinked to create a dialog with ws_child into the folder : in this case I can stop the others commands

I hope you understand me
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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

Continue the discussion