forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Scrollable format window?
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Mon Dec 09, 2013 3:36 pm    Post subject: Reply with quote

1) As i wrote, my latest example above works fine. It's my own larger code hiccups. But i am still looking at it. Do i have to use also SET_OPACITY@(Opacity) and USE_GDIPLUS@(state)? It is not used in the above example and opacity works fine. BTW, these functions are not recognized by the compiler probably because are not in the CLRWIN/windows.ins include file (?)

2) From the text above i see that developers prefer using function draw_line_between@ instead of just simpler draw_line@. Any reason for that? Do draw_lineD also exist?

3) I think the solution of %pv is an example that some things in Clearwin+ are still anti-intuitive and need polishing if even Paul does not immediately catch the twist. I made some plotting in callback below. Unless you have meant something different, this does not fix %pv. Solution though is as always simple but needs one hour of healthy non-stop swearing preferably in Russian Smile

Code:

winapp
program main
include <windows.ins>
!use clrwin
c_external nARGB@              '__nargb'(VAL,VAL,VAL,VAL):integer
c_external SET_SMOOTHING_MODE@ '__set_smoothing_mode'(VAL):integer
integer  cb
external cb

   ix=450;iy=200

!  iw = winio@("%pv%^gr[black,full_mouse_input,box_selection,user_resize,rgb_colours,popup]&",ix,iy,cb)
!  iw = winio@("%pv%gr[black,full_mouse_input,box_selection,rgb_colours,popup]&",ix,iy,cb)
  iw = winio@('%pv%^gr[user_resize]&',ix,iy,cb)
  iw = winio@("%ac[esc]&",'exit')
  iw = winio@("%lw",ilw)

  call draw_line_between@(5,158,440,188,         RGB@(0,200,0))


  call select_font@("Arial")
  call size_in_pixels@(16,0)
  call italic_font@(1)
  call bold_font@(1)
  call draw_characters@("No antiAlias Smoothing", 165, 200, RGB@(0,200,0))

  call set_line_width@(8)
  call set_line_style@(PS_GEOMETRIC+PS_ENDCAP_SQUARE)
  call draw_line_between@(5,4,5,108,  nARGB@(255,0,0,255))
  call draw_line_between@(25,4,25,108,  RGB@(255,0,0))
  call draw_line_between@(5,10,25,10, nARGB@(255,0,255,0))
  call draw_line_between@(5,30,25,30, nARGB@(112,0,255,0))
  call draw_line_between@(5,50,25,50,   RGB@(255,0,255))
  call set_line_style@(PS_GEOMETRIC+PS_ENDCAP_FLAT)
  call set_line_width@(16)
  iw = set_smoothing_mode@(5)        !SmoothingModeAntiAlias8x8
  call draw_line_between@(50,4,150,104,         RGB@(255,0,0))
  call draw_line_between@(150,4,50,104,       nARGB@(192,0,0,255))
  call draw_ellipse@(225,60,50,50,            nARGB@(255,0,255,0))
  call draw_filled_ellipse@(225,60,50,50,     nARGB@(192,255,0,0))
  call draw_rectangle@(320,10,420,110,        nARGB@(255,255,0,0))
  call draw_filled_rectangle@(320,10,420,110, nARGB@(192,0,255,0))
  call set_line_width@(1)
  call draw_line_between@(5,154,440,184,         RGB@(255,0,0))

  call select_font@("Arial")
  call size_in_pixels@(16,0)
  call italic_font@(1)
  call bold_font@(1)
  call draw_characters@("AntiAlias Smoothing", 165, 156, RGB@(255,0,0,255))


end
  integer function cb()
  include <windows.ins>
  call set_line_width@(7)
    call draw_line@ (1,1,450,200,         RGB@(0,0,0))
    call draw_line@ (1,200,450,1,         RGB@(0,0,0))
  call set_line_width@(1)
  cb=1
  end function cb      
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Dec 09, 2013 4:46 pm    Post subject: Reply with quote

1) There are various different ways to set the opacity and smoothing. These are described in a text file that should be in the download. Also the latest download has a new cwplus.enh that contains a description.

2) draw_line@ is the old 16 bit DBOS form. There is no draw_lineD@.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Dec 12, 2013 6:44 pm    Post subject: Re: Reply with quote

[quote="DanRRight"]Followup2 The couple problems with this SALFLIBC i found is that older compiled EXEs do not start now with the message "The procedure entry point _export_pcx could not be located in dynamic link library". If i recompile the files all works OK

Solved: Version 7.0 fixes that
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Dec 13, 2013 8:29 pm    Post subject: Reply with quote

By the way the answer why the demo above does not react on resizing despite of used %pv is because of missing %ww. Here is where you can not omit %ww I do not know why. Probably the Clearwin+ should allow resizing without %ww because not using %ww is very common
Back to top
View user's profile Send private message
FLEXPLAN3D



Joined: 25 Feb 2011
Posts: 27

PostPosted: Tue Jan 28, 2014 9:50 pm    Post subject: Reply with quote

Here is an example of a scrollable window that only shows scroll bars when
some of the controls lie outside the window. The window is resizable by the user.

The post is in 2 parts

PART 1 - The example program which creates a sample window


Code:


!  --------------------------------------------------
!  FTN95 Source File for a scrollable window
!  --------------------------------------------------

      PROGRAM MAIN
      INTEGER MENUFUNC
      CHARACTER BUTTONLABEL(20)*20,COLOURS(8)*7,COLOURARRAY(8,20)*7
     *,CURRCOLOR(20)*7
      REAL*8 VALUE(20)
      EXTERNAL MENUFUNC
      DATA COLOURS/
     *   'Red    ','Green  ','Blue   ','White  ','Black  ',
     *   'Yellow ','Cyan   ','Magenta'/
c*** create a window which is initially invisble and
c***  big enough to hold all the controls etc
      I=WINIO@('%ww[not_fixed_size]%ca[A SCROLLABLE WINDOW]&')
      I=WINIO@('%bg[grey]&')
c*** create simple menu
      I=WINIO@('%mn[Alpha,Beta[beta1,beta2,beta3],gamma]&'
     *,MENUFUNC,MENUFUNC,MENUFUNC,MENUFUNC,MENUFUNC)
c***  add a selection of controls to the window
      DO JROW=1,20
        WRITE(BUTTONLABEL(JROW),100)JROW
100     FORMAT('Button ',I2)
        I=WINIO@('%bt@&',BUTTONLABEL(JROW))
        VALUE(JROW)=JROW
        DO KOLOR=1,8
          COLOURARRAY(KOLOR,JROW)=COLOURS(KOLOR)
        ENDDO
        I=WINIO@('%`bg[yellow]&')       
        I=WINIO@('%ta%12sl[horizontal]&',VALUE(JROW),0d0,30d0)
        I=WINIO@('%taValue= &')
        I=WINIO@('%df%fl%`bg[white]%rf&',1d0,0d0,30d0,VALUE(JROW))
        I=WINIO@('%`bg[white]&')         
        CURRCOLOR(JROW)='Red'
        I=WINIO@('%ta%7.8el&',COLOURARRAY(1,JROW),8,CURrCOLOR(JROW))
        I=WINIO@('%ta%gr[RED]&',30,20)
        I=WINIO@('%2nl&')
      ENDDO
c*** finalize creation of the window,
c     making it visible and set to the required size
      CALL SETUPWINDOW(200,50,500,300)
      STOP
      END
   


      INTEGER FUNCTION MENUFUNC()
      INCLUDE <win32api.ins>
      CALL MESSAGEBOX(0,'Menu item selected','test',0)
      MENUFUNC=1
      RETURN
      END

Back to top
View user's profile Send private message AIM Address
FLEXPLAN3D



Joined: 25 Feb 2011
Posts: 27

PostPosted: Tue Jan 28, 2014 9:51 pm    Post subject: Reply with quote

Here are the scrolling functions for the example

PART 2

Code:


c------------------------
c*** scrolling functions
c------------------------


      MODULE SCROLLER
        INTEGER IVOFFSET,IHOFFSET,IVS,IHS,IHWND
     *  ,IVERTEXTENT,IHORIZEXTENT,IWINDOWWIDTH,IWINDOWHITE
      END MODULE SCROLLER



      SUBROUTINE SETUPWINDOW(IX,IY,IWIDTH,IHITE)
      USE SCROLLER
      INCLUDE <win32api.ins>
      INCLUDE <win32prm.ins>
      INTEGER RECT(4),SCROLLFUNC,RESIZEFUNC
      EXTERNAL SCROLLFUNC,RESIZEFUNC
C*** finalise the creation of the window
c*** add scrollbars
      IHS=0
      IVS=0
      I=WINIO@('%^`hs&',0,100,IHS,SCROLLFUNC)
      I=WINIO@('%^`vs&',0,100,IVS,SCROLLFUNC)
c*** get the window handle.
      I=WINIO@('%hw&',IHWND)
c*** provide a callback function for resizing the window
      I=WINIO@('%`mv&',RESIZEFUNC)
c*** return with closing window - so that we can modify it
      I=WINIO@('%lw',ICTRL)
c*** get the size of the invisble window which is needed for
c    scrolling calculations, and initialise the scrolling offset
      CALL GETWINDOWRECT(IHWND,RECT)
      IHORIZEXTENT=RECT(3)-RECT(1)
      IVERTEXTENT=RECT(4)-RECT(2)
      IHOFFSET=0
      IVOFFSET=0
c*** set the window to the position size we want and make it visible
      IWINDOWWIDTH=IWIDTH
      IWINDOWHITE=IHITE
      CALL SETWINDOWPOS(IHWND,HWND_TOP,IX,IY,
     *IWINDOWWIDTH,IWINDOWHITE,SWP_NOZORDER+SWP_SHOWWINDOW)
C***  call resize to show/hide scrollbars
      i= RESIZEFUNC()     
      RETURN
      END 


      INTEGER FUNCTION RESIZEFUNC()
      USE SCROLLER
      INCLUDE <win32api.ins>
      INCLUDE <win32prm.ins>
      INTEGER RECT(4)
      RESIZEFUNC=3
c***  the user has resized the window -get the new size
      CALL GETWINDOWRECT(IHWND,RECT)
      IWINDOWWIDTH=RECT(3)-RECT(1)
      IWINDOWHITE=RECT(4)-RECT(2)
C*** show or hide the scroll bars
      IF(IWINDOWWIDTH.GT.IHORIZEXTENT)THEN
        CALL SHOWSCROLLBAR(IHWND,SB_HORZ,0)
      ELSE
        CALL SHOWSCROLLBAR(IHWND,SB_HORZ,1)
      ENDIF
      IF(IWINDOWHITE.GT.IVERTEXTENT)THEN
        CALL SHOWSCROLLBAR(IHWND,SB_VERT,0)
      ELSE
        CALL SHOWSCROLLBAR(IHWND,SB_VERT,1)
      ENDIF
      RETURN
      END



      INTEGER FUNCTION SCROLLFUNC()
      USE SCROLLER
      INCLUDE <win32api.ins>
      INCLUDE <win32prm.ins>
      INTEGER CHILDWINDOWRECT(4),POINT(2)
      SCROLLFUNC=1
C** set the offsets from the top of the scrollable client area
      NEWHOFFSET=  IHS*(IHORIZEXTENT-IWINDOWWIDTH)/100
      NEWVOFFSET=  IVS*(IVERTEXTENT-IWINDOWHITE)/100
c*** set offset of client area from top left hand corner of window
       POINT=0
       CALL CLIENTTOSCREEN(IHWND,POINT)
c**** find all child windows for parent (ihwnd) - find first child
      ICHILD=GETWINDOW(IHWND,GW_CHILD)
1     IF(ICHILD.NE.0)THEN
C*** reposition child without repainting screen
        CALL GETWINDOWRECT(ICHILD,CHILDWINDOWRECT)
        IXCLIENT=CHILDWINDOWRECT(1)-POINT(1)
        IYCLIENT=CHILDWINDOWRECT(2)-POINT(2)
        IWID=CHILDWINDOWRECT(3)-CHILDWINDOWRECT(1)
        IHITE=CHILDWINDOWRECT(4)-CHILDWINDOWRECT(2)
        CALL MOVEWINDOW(ICHILD,IXCLIENT-NEWHOFFSET+IHOFFSET,
     *  IYCLIENT-NEWVOFFSET+IVOFFSET,IWID,IHITE,.FALSE.)
c** find next child
        ICHILD=GETWINDOW(ICHILD,GW_HWNDNEXT)
        GOTO 1
      ENDIF
      IVOFFSET=NEWVOFFSET
      IHOFFSET=NEWHOFFSET
C*** now repaint window
      CALL INVALIDATERGN(IHWND,0,0)
      CALL UPDATEWINDOW(IHWND)
      RETURN
      END
 
     
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Fri Mar 16, 2018 4:59 pm    Post subject: Button press in child window not received by parent window Reply with quote

I am experimenting with the techniques found in this thread.

If I attach a callback to the OK button and allow it to yield a result (say -10 to close the child), I don't get that result when the parent window closes.

How does one get the result from the child to be passed along to the parent?

Code:

   WINAPP
   integer ii, ctrl, wd, ht
        integer,external:: button10
   !child window with controls...
   ii=winio@("%sh&",ctrl)
   !Add your controls here...
   ii=winio@("Sample containing scrolling child window..&")
   ii=winio@("%3nl%cn%^6bb[OK]&",button10)
   ii=winio@("%3nl%cn%6bb[Cancel]")
   !Main window to display child with vertical scroll bar...
   ii=winio@("%ww[no_maxbox]&")
   ii=winio@("%ca[Scroll demo]&")
   wd = 280;  ht = 150
   ii=winio@("%sz&",wd,ht)
   ii=winio@("%ch[vscrollbar,hscrollbar]",ctrl)
   print *,ii
        stop
        end
        integer function button10()
        button10 = -10
        return
        end
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Fri Mar 16, 2018 5:33 pm    Post subject: Reply with quote

Is the return value from the child returned in the variable ctrl? Documentation says this is an input variable, but looking at it after the parent is closed yields the value of 10.

Coincidence??
Back to top
View user's profile Send private message Visit poster's website
silicondale



Joined: 15 Mar 2007
Posts: 243
Location: Matlock, Derbyshire, UK

PostPosted: Fri Mar 16, 2018 5:41 pm    Post subject: Reply with quote

Not sure that I understand what the problem is.
Surely it's easy to pass values back from child to parent. Simplest way is to use COMMON. Otherwise use variables defined in a MODULE.

Code:

   WINAPP
   integer ii, ctrl, wd, ht
   common/aaa/jvalue
        integer,external:: button10

   jvalue = 0

   !child window with controls...
   ii=winio@("%sh&",ctrl)
   !Add your controls here...
   ii=winio@("Sample containing scrolling child window..&")
   ii=winio@("%3nl%cn%^6bb[OK]&",button10)
   ii=winio@("%3nl%cn%6bb[Cancel]")
   !Main window to display child with vertical scroll bar...
   ii=winio@("%ww[no_maxbox]&")
   ii=winio@("%ca[Scroll demo]&")
   wd = 280;  ht = 150
   ii=winio@("%sz&",wd,ht)
   ii=winio@("%ch[vscrollbar,hscrollbar]",ctrl)
   print *,ii
   print *,'jvalue=',jvalue
        stop
        end
        integer function button10()
        common/aaa/jvalue

        jvalue = 1

        button10 = -10
        return
        end   

_________________
(Steve Henley)
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Fri Mar 16, 2018 7:08 pm    Post subject: Reply with quote

Actually, the simplest way is to get the result of a button press from the last winio@ call, and then use that result.

That said, if the %ch control will then return the value of the button press from within the child, I'm OK with that. And, it does appear that is the case!
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Fri Mar 16, 2018 7:54 pm    Post subject: Reply with quote

Creating the child window (formerly my main) and inserting it as a child works fine.
When I added the vertical scroll bar for the child window, my program crashes with some unknown error (no FTN95 error box). I tried doubling the stack and heap for the linker (/heap:12000000,6000000 /stack:9600000,4800000) but no good effect.

The child window is quite complex. Too long to post here. Are there controls that are incompatible in the child window with the child window scrollbars? %re? %ob? %ls? Any ideas?

Bill
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Tue Mar 27, 2018 4:53 am    Post subject: Reply with quote

I seem to remember from a problem some while back that &lw or %'lw has some influence in these matters.
I can'r find the specific post concerned but there's quite a ot of gobbledygook about it here:-

https://silverfrost.com/ftn95-help/clearwinp/d8attrib/leavewindowopen__lw.aspx

https://silverfrost.com/ftn95-help/clearwinp/formats/_lw.aspx

I remmber getting v & h scrolling working with one of Dan's %ps problem programs at the time wihtout problems.
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Mar 27, 2018 4:06 pm    Post subject: Reply with quote

Bill,

I do not think anything is specifically explicitly incompatible, the Clearwin withstands severe torture and after swearing and yelling eventually almost everything works.

There exist one not so clear Clearwin+ problem: the FTN95 (with one of its golden debug features to check for undefined variables) does ***not*** check if variables inside winio@ controls are undefined. As a result the %ls for example with some undefined variable can cause sometimes the crash of %ps.

Another not directly related thought - seems you are still using 32 bit FTN95. When your code growing in size starts to need adjustments of stack/heap that means it overgrown 32bit. This code will never reach stability in 32bits. Good is that we have 64bit FTN95. It is maturing fast but 64bit debugger is not yet perfectly polished compared to 32bit one. So try to rebuild the code such a way that both 32 and 64 will be working and if some hidden error will occur return to 32bits to debug.

Third, the crash also can occur when you are scrolling or continuously refreshing window using sliders %sl etc and did not ensure that previous I/O operation was fininished and did not overlap with the new request to plot or print
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Tue Mar 27, 2018 5:24 pm    Post subject: Reply with quote

Dan, thanks for the insights.

I'm sure that all the variables have an initial value. I've experienced the awful results when a winio@ call has an "undefined"! Never good.

I would have thought that increasing stack/heap by a factor of 4 might be enough in the case where allocations need to be made to do the internal scrolling. Perhaps not. That said, I understand that 64-bit is the wave of the future, and transitioning to this might be the thing to do to get this particular feature to work. I'm just not ready to go there.

So I have abandoned the scrolling of the window for now. I may revisit again when I get more time. I have a stripped down version for a Plato project to be used specifically for this; when I get the time, I play with it, trying to find which combination of controls I can remove and get it to work! If I get success, then I'll let you all know!
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Wed Mar 28, 2018 6:47 am    Post subject: Reply with quote

Playing around with your test code Bill I started to expand a little to take it into the realm of MDI windows.
Your example, taken from one of the ftn95 documentation examples for %sh if I'm not mistaken, is based on the '%ps' type philosophy for gettign scrolling child windows.
It depends what you want to do but maybe a simple MDI interface with individual scrollable windows is an alternative route ?
I hit a hitch in my botched up code (which combines your code with additional MDI additions) for which I've created a seperate post here so as not to confuse this post too much:
http://forums.silverfrost.com/viewtopic.php?t=3746
I have come across an error which talks about pivots present for non re-sizeable controls (although it doesn't specify which of course !) so that might mean your suspicons are correct for your mega-code, although I note that your original simple test code alone scrolls fine and both vertical and horizontal scrollbars work fine 'n' dandy.

Your point about 'ctrl' parameters and what they are is a good one. they are in fact wuoted as handles (for windows on assumes) in the description of %sh and %ch.
However in other descriptions concerning MDI's I've seen other 'definitions'
e.g. "%aw takes an INTEGER argument that is a control variable attached to the parent window"

So what are they exactly !!! I remember previous discussions (I remember Eddie is poised to do a PhD thesis on it Wink !) that there were comments that ther were Windows windows handles and then there were other 'controls' handles too, all of which are called handles, but then where does the 'control variable' definition pop into the equation ?
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group