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