QWin scrolling problem in text window

QWin scrolling problem in text window

[ Screenshots which I reference will be missing as they seem to be breaking the forum software ]

I have a QWin application and am having a problem configuring the windows so that they scroll
properly.  When the application first opens, it opens with a single text window which accepts user
input.  At this point it works just fine.  I can always see the bottom of the window (and
importantly the input prompt) and the window has scroll bars (see Screenshot-(2).jpg image).  The
function which opens this is pwopn( ) (see below).  When my second window, a plotting window, gets
opened by vopnwk( ) (see below), the program works functions fine, but the scrolling in the first
window is completely lost and no matter how I manipulate the windows (from the graphical interface)
I can never see to the bottom of the text window (see Screenshot-(3).jpg).  The scroll bars on the
text window are completely lost (they however do exist on the plotting window, the second window).
I've been through the QWin manual several times but can not seem to figure out what the correct
setting should be for when I open the windows.  Any pointers will be greatly appreciated.

My System:  Windows 10, Visual Studio Community 2017 ver 15.2,  Intel Parallel XE Studio 2017

-sanjay

      subroutine pwopn ()
      use        IFQWIN

      implicit   none

      type(windowconfig)  :: textscreen
      logical             :: status

      save

!     Open Child Console Window for text inputs

      open (unit = 5, file = 'CON')

!     Get Current Input Data Window Size

      status  = getwindowconfig(textscreen)

!     Set the x & y pixels & font to give 80 x 50 text window

      textscreen.numxpixels   =  800
      textscreen.numypixels   =  800
      textscreen.numtextcols  =  -1
      textscreen.numtextrows  =  -1
      textscreen.fontsize     = #000A0010
      textscreen.numcolors    =  -1
      textscreen.title =
     &"Finite  Element  Analysis  Program - Personal  Version"C

      textscreen.mode = qwin$scrolldown

      status = setwindowconfig(textscreen)
      if(.not.status) status = setwindowconfig(textscreen)

      status = deletemenuqq(3, 0)
      status = deletemenuqq(4, 0)

      status = displaycursor($gcursoron)

      end
      integer function vopnwk()

!     Open second window for plotting

      use        IFQWIN

      implicit   none

      include  'iofile.h'
      include  'plflag.h'
      include  'pdata2.h'

      integer         idxl,idyl,jfill
      common /vgraph/ idxl,idyl,jfill

      type(windowconfig) :: myscreen
      type(qwinfo)       :: winfo,frmwindow
      logical            :: status
      integer(2)         :: numfonts
      integer            :: uchild

!     Open workstation, home cursor, set up scaling

      if(screfl) then

        uchild = 7
        open(unit=uchild,file='user',title='F E A P p v    P l o t s')

!       Get window size data for plot outputs

        status  = getwsizeqq(uchild,qwin$sizecurr,winfo)
        status  = getwsizeqq(qwin$framewindow,qwin$sizemax,frmwindow)

!       Position for Graphics screen (in text row/columns shifts)

        winfo.X = winfo.X + 6*winfo.w/10  ! frmwindow.W - winfo.W
        winfo.Y = winfo.Y                 ! frmwindow.H - winfo.H

        winfo.type=qwin$set

        status  = setwsizeqq(uchild,winfo)
        if(.not.status) status = setwsizeqq(uchild,winfo)

!       Get screen capability

        status = getwindowconfig(myscreen)

!       Set sizes to maximum available

        myscreen.numtextcols=-1
        myscreen.numtextrows=-1
        myscreen.fontsize   =-1

!       Sizing graphics screen

        myscreen.numypixels= (myscreen.numypixels)*0.6
        myscreen.numxpixels= (myscreen.numypixels)*1.3

!       Set window configuration

        status = setwindowconfig(myscreen)
        if(.not.status) status = setwindowconfig(myscreen)

!       Set sizing for lines drawn by FEAP

        idyl   = nint(22480.0/(myscreen.numypixels))
        idxl   = idyl

        if(myscreen.numcolors .le. 4) then
          jfill = 1
        else
          jfill = 2
        endif

        vopnwk = displaycursor ( $GCURSOROFF   )
        call     clearscreen   ( $GCLEARSCREEN )

!       Set font for Arial outputs vector mode

        numfonts=initializefonts()
        if (numfonts.le.0) print *,"INITIALIZEFONTS error"
        if (grstatus().ne.$GROK) then
          write(*,*) 'INITIALIZEFONTS GRSTATUS error.'
        endif
        vopnwk =  setfont( 't''Arial''h14b' )

      endif

!     Tile Windows for Maximum Viewing

      status = focusqq(uchild)
      status = clickmenuqq(loc(WINSIZETOFIT))
      status = focusqq(5)             ! Input window active
      status = setactiveqq(uchild)

      vopnwk = 0

      end

 

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

When you open the 2nd plotting window, the original text window loses the Windows focus.  You can easily restore the focus:  rval = SetFocus (hWnd)   where hWnd is the handle of the text window.

Paul,

I was under the impression that these lines from the end of the routine that opens the second window would achieve exactly the restoration of the focus.

status = focusqq(uchild)
status = clickmenuqq(loc(WINSIZETOFIT))
status = focusqq(5)             ! Input window active
status = setactiveqq(uchild)

In particular line 1 sets the second window (uchild) to be active+focus, line 2 executes a click with respect to the second window (not sure why it is there, I did not write that line), line 3 I thought would make the first window (unit 5) to be active+focus, then line 4 makes the second window also active.

Also I was not able to find the command SetFocus( ) in the manual; I went looking since I want to know the datatype for the return value.

-sanjay

I managed to solve my problem by inserting a call to clickmenuqq(loc(WINSIZETOFIT)).  This seems to reactivate the scrollbars and life is good now.  Thus in the above 4 line snippet I just inserted a second

status = clickmenuqq(loc(WINSIZETOFIT))

between lines 3 and 4.

I think you had trouble finding the command SetFocus() because it is a Windows API routine, not Quickwin. Paul knows API very well but not Quickwin, and he often suggests API solutions when there is an even easier Quickwin one available. (The API routines work fine and have advantages as well, but note in this case that you would have to use another API routine to get the text window handle.)

Leave a Comment

Please sign in to add a comment. Not a member? Join today