Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Editing data with a dialog box

oscarh81
Beginner
312 Views
I am learning QuickWin and trying to write a simple QuickWin program with two dialog boxes, using CVF Standard Edition 6.1.A. The first dialog box (IDD_BOX_RESULTS) will have a button which will be used to open the second dialog box (IDD_BOX_DATA) to be used to enter values for X and Y variables in edit boxes.

With my code (see below) I am able to open the first box, click on the button and open the second box to edit values for X and Y, but the inital default values of X and Y are not shown (blank edit boxes are shown). I enter values for X and Y, then I close the second dialog box and go back to the first dialog box. When I click on the button to open again the second box, the values that I entered the first time are not displayed (blank edit boxes are shown).

1. How can I transfer the inital default X and Y values to the second dialog box?
2. How can I retain the edited values of X and Y for further use after closing the second dialog box?

Can someone please help?


program Test10

use dflogm
implicit none
include 'resource.fd'
external EditData
type (dialog) dlg
type (dialog) dlg_Data
logical lret


! Initialize main dialog box

if ( .not. DlgInit( IDD_BOX_RESULTS, dlg ) ) then
write (*,*) "error: resource not found"
else
!Initialize Data dialog
if ( .not. DlgInit( IDD_BOX_DATA, dlg_Data ) ) then
write (*,*) "error: resource not found"
else
! Set up default values for X and Y
lret = DlgSet( dlg_Data, IDC_EDIT_X, "2" )
lret = DlgSet( dlg_Data, IDC_EDIT_Y, "5" )

! Open data dialog box to edit X and Y
lret = DlgSetSub (dlg, IDC_BUTTON_DATA, EditData)
end if

lret = DlgModal (dlg)

end if
end program


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! subroutine EditData
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

subroutine EditData ( dlg, id, callbacktype)

use dflogm
implicit none
include 'resource.fd'
type (dialog) dlg
type (dialog) dlg_Data
integer id, callbacktype
logical lret

! Initialize EditData dialog

if ( .not. DlgInit( IDD_BOX_DATA, dlg_Data ) ) then
write (*,*) "error: resource not found"
else
! Edit X and Y values
lret = DlgSet( dlg_Data, IDC_EDIT_X, dlg_change )
lret = DlgSet( dlg_Data, IDC_EDIT_Y, dlg_change )

lret = dlgModal( dlg_Data)
end if

end subroutine
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
312 Views
See DlgGet function, which does the reverse of DlgSet. For question 1, you should transfer the contents of Dlg::IDC_EDIT_X to dlg_Data::IDC_EDIT_X

character(5):: sTemp

! Edit X and Y values
lret = DlgGet( dlg, IDC_EDIT_X, sTemp )
lret = DlgSet( dlg_Data, IDC_EDIT_X, sTemp )
lret = DlgGet( dlg, IDC_EDIT_Y, sTemp )
lret = DlgSet( dlg_Data, IDC_EDIT_Y, sTemp)


To convert sTemp to a number later, use internal READ.

Jugoslav
0 Kudos
Reply