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 

%sh and %sz

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Kenneth_Smith



Joined: 18 May 2012
Posts: 189
Location: Glasgow, Scotland.

PostPosted: Sun Dec 02, 2018 10:36 pm    Post subject: %sh and %sz Reply with quote

I have modified one of the examples in the documentation to convince myself that its possible to scroll over a graphics area embedded in a child with scroll bars:

Code:
program main
implicit none
include<windows.ins>
integer i, control_var1
integer gr_cb ; external gr_cb

! First sheet with 1600 x 800 graphics
i=winio@('%sh&',control_var1)
i=winio@('%bg[grey]&')
i=winio@('%^gr[red]&',1600,800, gr_cb)
call draw_filled_rectangle@(1600/4, 800/4, 3*1600/4, 3*800/4, rgb@(0,255,0))
i=winio@(' ')

! Main window to show child
i=winio@('%mn[Exit]&','exit')
i=winio@('%bg[grey]&')
i=winio@('%sz&',800,400)
i=winio@('%ch[vscrollbar,hscrollbar]&',control_var1)
i=winio@(' ')

end

integer function gr_cb()
include<windows.ins>
integer x, y, i
call get_mouse_info@(x,y,i)
print *,x,y
gr_cb=1
end function gr_cb


Taking this one step further suppose what was the main window is itself a child embedded in the main window:

Code:
program main
implicit none
include<windows.ins>
integer i, control_var1, control_var2
integer gr_cb ; external gr_cb

! First sheet with 1600 x 800 graphics
i=winio@('%sh&',control_var1)
i=winio@('%bg[grey]&')
i=winio@('%^gr[red]&',1600,800, gr_cb)
call draw_filled_rectangle@(1600/4, 800/4, 3*1600/4, 3*800/4, rgb@(0,255,0))
i=winio@(' ')

! Second sheet, only 800 x 400, first sheet embedded as child with scroll bars
i=winio@('%sh&',control_var2)
i=winio@('%bg[grey]&')
i=winio@('%sz&',800,400)
i=winio@('%ch[vscrollbar,hscrollbar]&',control_var1)
i=winio@(' ')

! Main window to show child
i=winio@('%mn[Exit]&','exit')
i=winio@('%bg[grey]&')
i=winio@('%ch&',control_var2)
i = winio@(' ')

end program main

integer function gr_cb()
include<windows.ins>
integer x, y, i
call get_mouse_info@(x,y,i)
print *,x,y
gr_cb=1
end function gr_cb


I still get the desired scroll bars but the size specified using %sz is neglected. I get similar results using %ww along with %'lw instead of %sh

Any ideas / pointers on how to achieve the desired result i.e. display of a quarter of the graphics area which I can move about using the scroll bars? There will be another child window along side with controls for the user to interact with.

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



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

PostPosted: Mon Dec 03, 2018 1:17 am    Post subject: Reply with quote

in the first exampl , the main window is half size of the child.

In the second example, the main window size is undefind, the smaller child window is half the size of the largr child.

I have difficulty seeing h you'll get a quarter size window to scroll around !

Isn't the solution simply to dfine the first child window t quarter size, i.e. 400 x 200 ?
_________________
''Computers are incredibly rigid. They question nothing. Especialy input data.Human beings are incredibly trusting of computers and don't check input data. Together they are capable of cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
John-Silver



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

PostPosted: Mon Dec 03, 2018 1:17 am    Post subject: Reply with quote

maybe a couple of screenshots would help understand better

Paul will be getting nervous as there are still some anomalies with nested child windows, reducing them, scrolling them, etc .... to sort out from quite a while back.
_________________
''Computers are incredibly rigid. They question nothing. Especialy input data.Human beings are incredibly trusting of computers and don't check input data. Together they are capable of cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 189
Location: Glasgow, Scotland.

PostPosted: Mon Dec 03, 2018 10:07 am    Post subject: Reply with quote

John,

The first example generates the following. A quarter of the image area is displayed (0.5 x 0.5 = 0.25)



The second example draws the whole image:-

Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Mon Dec 03, 2018 10:34 am    Post subject: Reply with quote

Ken

At the moment I can't work out what you are aiming for.

ClearWin+ does not have the concept of a child of a child in the sense implied by your code. %sh sheets are expected to be siblings with the same parent. In fact I suspect that ClearWin+ ought to generate a runtime fault when it encounters %ch after %sh (in the same window).
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1873
Location: Yateley, Hants, UK

PostPosted: Mon Dec 03, 2018 12:18 pm    Post subject: Reply with quote

Ken,

In my experience, if it seems difficult, it's because it might just be a non-standard (in the Windows sense) way of doing something, and the Windows way might be rather different (and possibly inferior).

Once you have an idea about an element in a graphics interface, it is worth looking around for another application that does it the way you want to. If you can't find one, it tells you a lot.

I couldn't get in-cell editing to work for me in a grid of data (I gave up ages ago), but I gained comfort from the fact that early versions of Excel couldn't either, and what it does now looks to me to be a compromise.

Eddie
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 189
Location: Glasgow, Scotland.

PostPosted: Mon Dec 03, 2018 12:45 pm    Post subject: Reply with quote

Thanks Paul,

I've not used child windows before so I am on a learning curve, and experimenting.

For the long dark winter nights I have tasked myself with developing a schematic capture application for one of my programs which presently reads a power system configuration in as a netlist - which is always prone to error. Hence my earlier question last week about %gr selections.

Screenshot below is as far as I have got so far, with the graphics area displayed in one box and a collection of controls in the other. Obvious problem what happens with the network is too large to be drawn in the available space - hence I was trying to find a way to scroll the graphics, which led on to thinking about using child windows, and then to a child with its own child, which I now know is not a valid concept. No matter I have another potential solution - multiple pages and storing the active page number when an item is drawn (all data for each item is a derived type) and a special component to link two nodes on separate pages.




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



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

PostPosted: Tue Dec 04, 2018 2:50 am    Post subject: Reply with quote

Paul,
your statement above seems at first glance to be contradicted by:
Quote:
A child window is a window that is contained within a larger window (which could be a child of yet another window).

here:-
https://www.silverfrost.com/ftn95-help/clearwinp/glossary/childwindow.aspx

but then ....

Ken,
your code as it's set up is trying to put a sheet in a sheet. I think that's what Paul means by it's not intended to do it as you're trying to set it up.

I think you ned to set it up via a frame (%fr) within the main window and then open a child window (%aw), with a %sh to get the control bars; and similarly for the seecond window you need, but without the sheet if you don't need one.

It's a problem of logic I think, not an impossibility to do it.
_________________
''Computers are incredibly rigid. They question nothing. Especialy input data.Human beings are incredibly trusting of computers and don't check input data. Together they are capable of cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 189
Location: Glasgow, Scotland.

PostPosted: Sun Dec 09, 2018 5:43 pm    Post subject: Reply with quote

Progress to date:-

https://www.youtube.com/watch?v=tM2F2NNaHxY

Thanks to those who emailed and messaged me with suggestions.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Sun Dec 09, 2018 6:35 pm    Post subject: Reply with quote

It seems to me that what is needed is the option to provide a %gr region with scroll bars. In any case this would be a useful addition to ClearWin+.

At the moment I don't know if and when this feature could be added.
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
Page 1 of 1

 
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