! *********************************************** ! ** (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 : Hiding the root window ** ! *********************************************** ! ! WiSk allows the main root window to be hidden from view thus ! giving the impression that the dialog is the main input window. This ! is useful for writing simple dialog input applications. ! ! It is important to note that InsideRoot child windows will NOT work ! when the root window is hidden. Child dialogs will also be unavailable. ! Only POPUP dialogs can be used. ! ! This program shows how to use a hidden root window and a dialog ! to create other floating child windows ! PROGRAM HIDDEN ! ! Use of the WINTERACTER module is compulsory ! USE WINTERACTER IMPLICIT NONE ! ! Resource identifiers, as set via the resource editor ! INTEGER, PARAMETER :: IDD_DIALOG01 = 101 INTEGER, PARAMETER :: ID_CREATEWIN = 1002 INTEGER, PARAMETER :: ID_CLOSEWIN = 1003 INTEGER, PARAMETER :: ID_EXIT = 1004 ! INTEGER :: IHANDLE,ITYPE TYPE(WIN_MESSAGE) :: MESSAGE ! ! Initialise Winteracter ! CALL WInitialise() ! ! Create a hidden root window ! CALL WindowOpen(HideWindow) IHANDLE = 0 ! ! Display our main control dialog ! CALL WDialogLoad(IDD_DIALOG01) CALL WDialogShow() ! ! Main message loop ! DO CALL WMessage(ITYPE, MESSAGE) SELECT CASE (ITYPE) ! ! In this program all actions are managed via push buttons on the dialog ! CASE (PushButton) SELECT CASE (MESSAGE%VALUE1) ! ! Create an external child window ! CASE (ID_CREATEWIN) IF (IHANDLE==0) THEN CALL WindowOpenChild( & IHANDLE, & FLAGS =SysMenuOn+MinButton+MaxButton, & X =10, & Y =10, & WIDTH =480, & HEIGHT=320, & TITLE ='Popup window') CALL DOPLOT() END IF ! ! Close external child window ! CASE (ID_CLOSEWIN) IF (IHANDLE/=0) THEN CALL WindowCloseChild(IHANDLE) IHANDLE = 0 END IF ! ! Check for the Exit push-button or for a Close request. ! The latter will come from any of the following : ! - The dialog window close button ('x') under Windows 4 ! - Selecting Close on the dialogs System menu ! - Pressing Alt/F4 ! - Pressing Escape ! CASE (ID_EXIT,IDCANCEL) ! Exit program EXIT END SELECT ! ! Expose/resize messages will only be received from the child window ! CASE (Expose,Resize) CALL DOPLOT() ! ! A CloseRequest message will only come from closing ! a child window when the root window is hidden ! CASE (CloseRequest) CALL WindowCloseChild(IHANDLE) IHANDLE = 0 END SELECT END DO ! ! We still must call WindowClose to remove any windows/dialogs ! from the screen and correctly terminate WiSK ! CALL WindowClose() STOP ! CONTAINS ! SUBROUTINE DOPLOT() ! ! Draw some a line graph, bar chart & histogram ! IMPLICIT NONE ! REAL, DIMENSION(4) :: TX,TY REAL, DIMENSION(5) :: A = (/50.0,20.0,4.0,93.0,65.0/) INTEGER :: IX ! ! Define a graphics area and clear it ! CALL IGrArea(0.0,0.0,1.0,1.0) CALL IGrUnits(0.0,0.0,1.0,1.0) CALL IGrAreaClear() ! ! Output titles ! CALL IGrColourN(160) CALL WGrTextFont(FFHelvetica,WIDTH=0.02,HEIGHT=0.05) CALL WGrTextOrientation(AlignLeft) CALL WGrTextString(0.1,0.90,'Graph constructed using the') CALL WGrTextString(0.1,0.82,'Lahey / Winteracter Starter Kit') ! ! Draw a bar chart ! CALL IGrColourN(223) CALL IGrUnits(-1.0,-1.0,110.0,110.0) DO IX = 1,10,2 CALL IGrFillPattern(Solid) TX(1) = 10.0 + 10.0 * (IX - 1) TY(1) = 10.0 TX(2) = 10.0 + 10.0 * (IX - 1) TY(2) = 10.0 + A((IX+1)/2) TX(3) = 20.0 + 10.0 * (IX - 1) TY(3) = 10.0 + A((IX+1)/2) TX(4) = 20.0 + 10.0 * (IX - 1) TY(4) = 10.0 CALL IGrColourN(10*IX) CALL IGrPolygonComplex(TX,TY,4) CALL IGrFillPattern(Outline) CALL IGrColourN(223) CALL IGrPolygonComplex(TX,TY,4) END DO CALL IAxes() RETURN END SUBROUTINE DOPLOT ! SUBROUTINE IAxes() ! IMPLICIT NONE ! INTEGER :: IX,IPOS CHARACTER(LEN=3) :: STRING ! CALL IGrColourN(216) CALL IGrMoveTo(3.0 , 10.0) CALL IGrLineTo(105.0, 10.0) CALL IGrMoveTo(5.0 , 8.0) CALL IGrLineTo(5.0 ,100.0) ! ! Select Courier font ! CALL WGrTextFont(FFCourier,WIDTH=0.015,HEIGHT=0.045) ! ! Draw some annotation on the X-axis ! CALL WGrTextOrientation(AlignCentre) DO IX = 15,105,10 CALL IGrMoveTo(REAL(IX),10.0) CALL IGrLineTo(REAL(IX), 8.0) CALL IntegerToString(IX-5,STRING,'(I3)') IF (IX-5 < 100) THEN IPOS = 2 ELSE IPOS = 1 END IF CALL WGrTextString(REAL(IX),4.0,STRING(IPOS:)) END DO ! ! Draw some annotation on the Y-axis ! CALL WGrTextOrientation(AlignRight) DO IX = 20,100,20 CALL IGrMoveTo(5.0,REAL(IX)) CALL IGrLineTo(4.0,REAL(IX)) CALL IntegerToString(IX/10,STRING,'(I2)') CALL WGrTextString(3.7,REAL(IX),STRING(:2)) END DO ! ! Put a zero at axis intersection ! CALL IGrCircle(5.0,10.0,0.75) RETURN END SUBROUTINE IAxes ! END PROGRAM HIDDEN