Window and a Resizable dialog inside

Window and a Resizable dialog inside

Postby MarcoBoschi » Sat Jul 02, 2011 4:13 pm

#include "fivewin.ch"

FUNCTION MAIN()


LOCAL oMain

DEFINE WINDOW oMain FROM 10 , 10 TO 500 , 500 PIXEL

ACTIVATE WINDOW oMain ON INIT OpenDialog()

RETURN NIL



FUNCTION OPENDIALOG()
LOCAL oDlg
LOCAL oSay
DEFINE DIALOG oDlg FROM 200 , 200 TO 400 , 400 ;
STYLE NOR( WS_POPUP, WS_VISIBLE, WS_CAPTION, WS_THICKFRAME, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX ) PIXEL
@ 2 , 2 SAY oSay PROMPT "Here'is a TWBROWSE"
ACTIVATE DIALOG oDLg
RETURN NIL



This is the question: is it possible to Iconize oMain Window when oDlg Dialog is Open?
A Customer ask to me....
It's not a bad question.....


Marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Window and a Resizable dialog inside

Postby ukoenig » Sat Jul 02, 2011 6:28 pm

Marco,

maybe the 3. Screenshot ?

viewtopic.php?f=3&t=21857&p=116333#p116333

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

Re: Window and a Resizable dialog inside

Postby Antonio Linares » Sat Jul 02, 2011 6:39 pm

Marco,

This is another possibility:

Code: Select all  Expand view
#include "fivewin.ch"

FUNCTION Test()

   LOCAL oMain

   DEFINE WINDOW oMain FROM 10 , 10 TO 500 , 500 PIXEL

   ACTIVATE WINDOW oMain ON INIT ( oMain:Center(), OpenDialog( oMain ) )

RETURN NIL

FUNCTION OPENDIALOG( oMain )

   LOCAL oDlg, oSay

   DEFINE WINDOW oDlg FROM 200, 200 TO 400, 400 PIXEL OF oMain

   @ 2 , 2 SAY oSay PROMPT "Here'is a TWBROWSE"

   ACTIVATE WINDOW oDLg

RETURN NIL
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Window and a Resizable dialog inside

Postby MarcoBoschi » Sun Jul 03, 2011 8:11 am

Thank you veru much.
But the dialog containing the twbrose has 16 obiejcts: button, get, btnbmp etc. etc.

I declare it in this way:

DEFINE DIALOG oDlg RESOURCE "lis_de" FONT oFnt2
I use Pelles to create it!
For a Windows I have to use these jind of commands

@ 1 , 1 GET oGet VAR cGet
instead of
REDEFINE gET oGet VAR cGet



When I select a record I open another form dialog to edit the conteno of record, this dialog has 100 objects:

It's an hard work for me to re-write all program without external resources....


Many thanks

Marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Window and a Resizable dialog inside

Postby Antonio Linares » Sun Jul 03, 2011 8:27 am

Marco,

With this way you can use resources :-)

Please notice that I use WS_CHILD instead of WS_POPUP and also NOWAIT clause

Code: Select all  Expand view
#include "fivewin.ch"

FUNCTION Main()

   LOCAL oMain

   DEFINE WINDOW oMain FROM 10 , 10 TO 500 , 500 PIXEL

   ACTIVATE WINDOW oMain ON INIT OpenDialog( oMain )

RETURN NIL

FUNCTION OPENDIALOG( oWnd )

   LOCAL oDlg, oSay

   DEFINE DIALOG oDlg FROM 200 , 200 TO 400 , 400 ;
STYLE nOr( WS_CHILD, WS_CAPTION, WS_THICKFRAME, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX ) PIXEL OF oWnd

   @ 2 , 2 SAY oSay PROMPT "Here'is a TWBROWSE"

   ACTIVATE DIALOG oDLg NOWAIT

RETURN NIL
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Window and a Resizable dialog inside

Postby MarcoBoschi » Mon Jul 04, 2011 7:41 am

Antonio,
NOWAIT clause create problems when I close database at the end of function and the Timer defined is not working.
I think that the best solution is to use WINDOW instead of DIALOG but only for list dialog not for form dialog.

King regards

Marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Window and a Resizable dialog inside

Postby Antonio Linares » Mon Jul 04, 2011 7:47 am

Marco,

If you could provide a more complete example then we may provide you a better solution :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Window and a Resizable dialog inside

Postby MarcoBoschi » Mon Jul 04, 2011 12:48 pm

Thank you Antonio,
I don't like the idea that once I open the dialog the control passes immediately to the line **1

It scares me :?

Code: Select all  Expand view


#include "fivewin.ch"
REQUEST HB_GT_GUI_DEFAULT

FUNCTION Main()

   LOCAL oMain , oDlg

   DEFINE WINDOW oMain FROM 10 , 10 TO 500 , 500 PIXEL

   ACTIVATE WINDOW oMain ON INIT ( oDlg := OpenDialog( oMain )  , msginfo( "Passed from here " + ALIAS () ) ) // **1


RETURN NIL

FUNCTION OPENDIALOG( oWnd )

   LOCAL oDlg
   LOCAL oBrw
   LOCAL oTimer
   LOCAL oButClose
   USE customer


   DEFINE DIALOG oDlg FROM 10 , 10 TO 400 , 400 ;
STYLE nOr( WS_CHILD, WS_CAPTION, WS_THICKFRAME, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX ) PIXEL OF oWnd

DEFINE TIMER oTimer OF oDlg INTERVAL 1000 ACTION ( tone( 1000 , 2 ) , oBrw:refresh() )
@ 3 , 1 LISTBOX oBrw ;
      FIELDS field->last, field->first ;
      HEADERS "Last", "Name" ;
      SIZE 700, 800 ;
      OF oDlg

  @ 1 , 1 BUTTON oButClose OF oDlg ACTION ( dbclosearea() , oDlg:end()  , MsgInfo( ALIAS() ) )

   ACTIVATE DIALOG oDLg NOWAIT ON INIT ( oTimer:hWndOwner := oDlg:hWnd , oTimer:Activate() )



RETURN oDlg
 
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Window and a Resizable dialog inside

Postby Antonio Linares » Mon Jul 04, 2011 7:39 pm

Marco,

It does not matter at all. It goes to ACTIVATE WINDOW ... as the dialog is non modal.

The events will get routed to the right codeblocks, so there is nothing to worry about it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Window and a Resizable dialog inside

Postby MarcoBoschi » Tue Jul 05, 2011 9:33 am

Antonio,
many thanks for your time.
This is a minimal example, classical scenario:

1 window
2 dialog containing listview
3 dialog containing form view

When list view is open (function lista) it's possible to iconize window
When form view is open (function modifica) it is not possible to iconize window
I tried to make modifica dialog iconizable too but the program hangs.
In my opinion is good having a modal dialog when the record is locked

marco


Code: Select all  Expand view
#include "fivewin.ch"
REQUEST HB_GT_GUI_DEFAULT
#define crlf CHR(13)+CHR(10)

FUNCTION Main()

   LOCAL oMain
   LOCAL oButton, oButAli

   DEFINE WINDOW oMain FROM 100 , 100 TO 600 , 800 PIXEL

   @ 1 , 1  BUTTON oButton PROMPT "Dialog" ACTION Lista( oMain )       SIZE 100 , 30
   @ 1 , 30 BUTTON oButali PROMPT "Alias?" ACTION ana_ali()        SIZE 100 , 30

   ACTIVATE WINDOW oMain


RETURN NIL

FUNCTION LISTA( oMain )

   LOCAL oDlg
   LOCAL oBrw
   LOCAL oTimer
   LOCAL oButClose

   USE customer


   DEFINE DIALOG oDlg FROM 100 , 50 TO 400 , 500 ;
STYLE nOr( WS_CHILD, WS_CAPTION, WS_THICKFRAME, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX ) PIXEL OF oMain

DEFINE TIMER oTimer OF oDlg INTERVAL 1000 ACTION ( tone( 1000 , 2 ) , oBrw:refresh() )

@ 3 , 1 LISTBOX oBrw ;
      FIELDS field->last, field->first ;
      HEADERS "Last", "Name" ;
      SIZE 200 , 100 ;
      OF oDlg
     oBrw:blDblClick := { || modifica( oTimer )  , oBrw:refresh(.T.) }

  @ 1 , 1 BUTTON oButClose OF oDlg ACTION ( dbclosearea() , oDlg:end()  , MsgInfo( ALIAS() ) )

   ACTIVATE DIALOG oDLg NOWAIT ON INIT ( oTimer:hWndOwner := oDlg:hWnd , oTimer:Activate() ) VALID finedialogo( )


RETURN NIL

FUNCTION FINEDIALOGO()
dbclosearea()
RETURN .T.

FUNCTION MODIFICA( oTimer )
LOCAL oDlg
LOCAL oLast  , cLast  := field->last
LOCAL oFirst , cFirst := field->first

oTimer:deactivate()

   DEFINE DIALOG oDlg FROM 100 , 50 TO 300 , 300 PIXEL

   @ 1 , 1 GET oFirst VAR cFirst OF  oDlg
   @ 3 , 1 GET oLast  VAR cLast  OF  oDlg

   ACTIVATE DIALOG oDlg


oTimer:activate()
RETURN NIL

FUNCTION ANA_ALI()
LOCAL i := 1
LOCAL cElenco := ""
LOCAL area_ta := SELECT()
LOCAL cSelected := ALIAS()

FOR i = 1 TO 120
    IF !EMPTY(ALIAS( i ) )
       IF cSelected = ALIAS( i )
          cSelected := "*"
       ELSE
          cSelected := ""
       ENDIF
       cElenco := cElenco + STR(i ,3) + " " + ALIAS( i )  + cSelected + crlf
    ENDIF
NEXT i
MsgInfo( cElenco , "Alias:" )
SELECT (area_ta)
RETURN NIL
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 98 guests