! *********************************************** ! ** (c) Interactive Software Services Ltd and ** ! ** Lahey Computer Systems Inc. 1997-2011 ** ! ** ----------------------------------------- ** ! ** This demonstration program source may be ** ! ** modified for training and for product ** ! ** familiarisation. ** ! ** ----------------------------------------- ** ! ** Purpose : Drawing into a dialog field ** ! *********************************************** ! ! This program shows how to redirect Winteracter graphics output ! to a dialog field. As the user alters the dialog fields the ! graphics display is updated automatically. ! PROGRAM DLGDRAW ! USE WINTERACTER IMPLICIT NONE ! TYPE(WIN_MESSAGE) :: MESSAGE INTEGER :: ITYPE INTEGER :: ISHAPE = 1 INTEGER :: ICOL = 1 ! ! Resource identifiers, as set via the resource editor ! INTEGER, PARAMETER :: IDD_DIALOG1 = 101 INTEGER, PARAMETER :: IDF_SHAPE1 = 1001 INTEGER, PARAMETER :: IDF_COL1 = 1004 INTEGER, PARAMETER :: IDF_PICTURE1 = 1008 ! ! Initialise Winteracter ! CALL WInitialise() ! ! Open root window hidden ! CALL WindowOpen(HideWindow) ! ! Load our main dialog ! CALL WDialogLoad(IDD_DIALOG1) ! ! Enable field changed messages ! CALL WMessageEnable(FieldChanged,Enabled) ! ! Show dialog ! CALL WDialogShow(ITYPE=Modeless) ! ! Send all graphics output to the picture frame field ! CALL IGrSelect(3,IDF_PICTURE1) CALL DrawShape(ISHAPE,ICOL) ! ! Main Message Loop ! DO CALL WMessage(ITYPE, MESSAGE) SELECT CASE (ITYPE) ! ! Push button pressed ! CASE (PushButton) SELECT CASE (MESSAGE%VALUE1) CASE (IDCANCEL) EXIT CASE (IDHELP) CALL WMessageBox(OKOnly,InformationIcon,CommonOK, & 'This demo shows how to send Winteracter graphics '// & 'output to a dialog field.'//CHAR(13)//CHAR(13)// & 'Use the dialog controls to alter the appearance of the picture.','Help') END SELECT ! ! Expose event - Redraw our graph ! CASE (Expose) IF (MESSAGE%VALUE3 == FromDialog.AND. & MESSAGE%VALUE4 == IDF_PICTURE1) THEN CALL DrawShape(ISHAPE,ICOL) END IF ! ! FieldChanged event - Update graph is required when field value changed ! Ignore movement between fields ! CASE (FieldChanged) IF (MESSAGE%VALUE1 == MESSAGE%VALUE2) THEN CALL WDialogGetRadioButton(IDF_SHAPE1,ISHAPE) CALL WDialogGetRadioButton(IDF_COL1 ,ICOL) CALL DrawShape(ISHAPE,ICOL) END IF END SELECT END DO ! ! Close the program and exit ! CALL WindowClose() STOP ! CONTAINS ! !************************************************************************** ! SUBROUTINE DrawShape(ISHAPE,ICOLR) ! ! Draw one of three simple shapes in one of three colours ! IMPLICIT NONE ! INTEGER, INTENT(IN) :: ISHAPE,ICOLR ! ! Clear graphics area ! CALL IGrAreaClear() ! ! Choose colour ! CALL IGrColourModel(24) SELECT CASE (ICOLR) CASE (1) CALL IGrColourN(RGB_GREEN) CASE (2) CALL IGrColourN(RGB_BLUE) CASE (3) CALL IGrColourN(RGB_MAGENTA) END SELECT ! ! Draw shape ! CALL IGrFillPattern(Solid) SELECT CASE (ISHAPE) CASE (1) ! Triangle CALL IGrPolygonComplex((/0.1,0.5,0.9/), & (/0.1,0.9,0.1/),3) CASE (2) ! Rectangle CALL IGrPolygonComplex((/0.1,0.1,0.9,0.9/), & (/0.1,0.9,0.9,0.1/),4) CASE (3) ! Circle CALL IGrCircle(0.5,0.5,0.3) END SELECT RETURN END SUBROUTINE DrawShape ! END PROGRAM DLGDRAW