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 

Resizing different %gr areas in the same window
Goto page Previous  1, 2, 3  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: 1875
Location: South Pole, Antarctica

PostPosted: Mon Apr 16, 2018 11:22 pm    Post subject: Reply with quote

Noticed that while I made windows resizable the first two windows' surprisingly lost the ability to plot (display_bar and control_panel)? This may take some more swearing to find why.
Back to top
View user's profile Send private message
John-Silver



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

PostPosted: Wed Apr 18, 2018 10:28 pm    Post subject: Reply with quote

Hi Dan,
I'm catching up here.
When I run your code (v8.1+dlls23) all the windows initially give me graphics but after I re-size (which works ok) for any of the 4 windows the graphics disappear.
This is not surprising as the callback 'empty' does nothing.
Even though it says the call to the callback should auto-redraw I tried adding this to the callback 'empty', but still nothing appears when I resixìze the 'simulation' wndow ...

Code:
! - test - in callback 'empty' give it something to do on re-size !
iemp=select_graphics_object@(simulation)
call draw_filled_rectangle@(10,10,200,200,rgb@(30,255,30))
call draw_filled_ellipse@(100,100,80,80,rgb@(127,59,30))
CALL PERFORM_GRAPHICS_UPDATE@()


Additionally, if I reduce any of the windows using the top right icon the window just plain disappears (not to an icon in the parent window, nor to taskbar.
When you do that with my working mdi code (which differs in that it uses %ch in order to get scrollbars) the windows reduce to an icon at bottom of parent window.
_________________
''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 "


Last edited by John-Silver on Fri Apr 20, 2018 5:44 am; edited 3 times in total
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Thu Apr 19, 2018 1:55 pm    Post subject: Reply with quote

Hell knows, way to many options to try. Needs more swearing time. This is why i use word 'devilry' too often.
Back to top
View user's profile Send private message
John-Silver



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

PostPosted: Fri Apr 20, 2018 2:49 pm    Post subject: Reply with quote

Forget what I said above, it works (after a fashion -see below) albeit that you need also to add a include 'windows.ins' at the top of the function too.
I had inadvertently omitted it, not seen that the compile failed, and had been re-running a previous version ! doh !)

Replace the callback function in your code Dan with this:-

integer function empty ()
include <windows.ins>
call draw_filled_rectangle@(10,10,200,200,rgb@(125,125,125))
call draw_filled_ellipse@(175,175,60,90,rgb@(127,59,30))
empty=0
end function

This is a 'quick-n-dirty' demonstration because as it stands this same call-back is invoked for each of the 3
graphics areas.

In reality the contents of each window should be specified in 3 seperate call-back as required

The modified full code below does that, and all the windows now resize and the 'simulation' window now re-sizes with the original contents in it.

However (isn't there always one !) the other windows, when re-sized, go blank and their graphic content is re-drawn always in the 'simulation' window !!!

It seems to be hanging onto the last created graphics region handle rather than using the one from which the callback is made.

__________________________________________________

A more general question for Paul is what does re-sizing actually mean ?

%pv description says the control (in this case the %gr) can be re-sized, but in fact it only allows the window in which it is contained to be re-sized and the %gr remains the same size.

However, the %pl control re-sizes (scales) when it's in a window and the window is re-sized.

Confusing man.

Full modified code to follow ........
_________________
''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: 925
Location: Aerospace Valley

PostPosted: Fri Apr 20, 2018 2:54 pm    Post subject: Reply with quote

here it is .....

Code:
!
!  Rudnei's_GR_cod_mdi_DanSol-1c2a.f90
!
winapp
program test_mdi1
implicit none
include <windows.ins>

integer      :: i1,i2,i3,i4, ixF, iyF, rslt, main_window, control_panel, display_bar, simulation
integer iT, iTextUnit
integer, external :: draw_control_panel, draw_display_bar, draw_simulation

common /GR_areas_ids/main_window, control_panel, display_bar, simulation

ixF=1100
iyF=1000
iTextUnit=2 ! was 0 before version 8.30

i1=winio@('%ww[no_border]%es&')
i1=winio@('%ca[Main Window containing an MDI frame]&')
i1=winio@('%pv%fr%lw',ixF,iyF, main_window)


iT=winio@('%aw%ww[no_border]%ca[Text Window]%pv%40.8cw', &
main_window, iTextUnit )

i2=winio@('%aw%ww[no_border]%ca[Control Panel]%pv%`^gr[black,user_resize]', &
main_window, 300,200,control_panel, draw_control_panel )

i3=winio@('%aw%ww[no_border]%ca[Display Bar]%pv%`^gr[white,rgb_colours,user_resize]', &
main_window, 500,400, display_bar, draw_display_bar )


i4=winio@('%aw%ww[no_border]%ca[Simulation]%pv%`^gr[black,user_resize]', &
main_window, 800,800, simulation, draw_simulation )



!... Text window
Print*, 'This is Text window'

end program test_mdi1


!..............................................................
integer function draw_control_panel ()
include <windows.ins>


! Desenha no painel de controle
call draw_filled_ellipse@(100,100,80,80,rgb@(127,59,30))

draw_control_panel=0
end function


!..............................................................
integer function draw_display_bar ()
include <windows.ins>


! Desenha na barra de cores
call draw_filled_rectangle@(2,2,398,398,rgb@(255,255,30))

draw_display_bar=0
end function


!..............................................................
integer function draw_simulation ()
include <windows.ins>


! Desenha na área de simulação
call draw_filled_rectangle@(10,10,200,200,rgb@(30,255,30))
call draw_filled_rectangle@(100,50,120,60,rgb@(255,0,30))
call draw_filled_rectangle@(400,400,600,5000,rgb@(30,0,255))

draw_simulation=0
end function

_________________
''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: 925
Location: Aerospace Valley

PostPosted: Fri Apr 20, 2018 3:30 pm    Post subject: Reply with quote

I jut printed out the values of: control_panel, display_bar, simulation
and they're ALL ZERO ! which maybe explains why all graphics updates go to the last created window ?

Paul are you sure a correct value is output from %gr ?
_________________
''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
DanRRight



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

PostPosted: Sat Apr 21, 2018 11:27 am    Post subject: Reply with quote

I took your contribution and now it plots on each screen but still does not work right.

Why handle for each of 3 graphics windows are all the same is a good question. Due to that every time we click on any window the plotting goes to the last screen instead the current one

Here is what i changes in your code:

1) each callback calls select_graphics_object@ function before doing any drawings. And

2) the callback does have value 2 not zero at the end, this is default for Clearwin+ . Zero might be used if you want to close window on any click on it

3) i removed "implicit none" as it made me nuts and swear louder very quickly asking to declare each and every damn junk variable i introduce like i44 in each and every subroutine. Or requiring to declare each variable in common blocks in all these Functions. To avoid that requires using modules but modules have another bad property: when your code will grow one big module will eventually swallow all others making one huge monopoly which has nothing more but die

We may continue to swear...err...try some more permutations before asking Paul to comment, i have couple other demos which actually worked pretty well switching graphics windows.

Code:
winapp
program test_mdi1
include <windows.ins>

integer      :: i1,i2,i3,i4, ixF, iyF, rslt, ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation
integer iT, iTextUnit
integer, external :: draw_control_panel, draw_display_bar, draw_simulation

common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation

ixF=1100
iyF=1000
iTextUnit=2 ! was 0 before version 8.30

i1=winio@('%ww[no_border]%es&')
i1=winio@('%ca[Main Window containing an MDI frame]&')
i1=winio@('%pv%fr%lw',ixF,iyF, ihgw_main_window)


iT=winio@('%aw%ww[no_border]%ca[Text Window]%pv%40.8cw', &
ihgw_main_window, iTextUnit )

i2=winio@('%aw%ww[no_border]%ca[Control Panel]%pv%`^gr[black,user_resize]', &
ihgw_main_window, 300,200,ihgw_control_panel, draw_control_panel )

i3=winio@('%aw%ww[no_border]%ca[Display Bar]%pv%`^gr[white,rgb_colours,user_resize]', &
ihgw_main_window, 500,400, ihgw_display_bar, draw_display_bar )

i4=winio@('%aw%ww[no_border]%ca[ihgw_simulation]%pv%`^gr[black,user_resize]', &
ihgw_main_window, 800,800, ihgw_simulation, draw_simulation )

!... Text window
Print*, 'This is Text window'

end program test_mdi1

!..............................................................
integer function draw_control_panel ()
include <windows.ins>
common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation

i44=select_graphics_object@(ihgw_control_panel)

call draw_filled_ellipse@(100,100,80,80,rgb@(127,59,30))

draw_control_panel=2
end function

!..............................................................
integer function draw_display_bar ()
include <windows.ins>
common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation

i44=select_graphics_object@(ihgw_display_bar)

call draw_filled_rectangle@(2,2,398,398,rgb@(255,255,30))

draw_display_bar=2
end function

!..............................................................
integer function draw_simulation ()
include <windows.ins>
common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation

i44=select_graphics_object@(ihgw_simulation )

call draw_filled_rectangle@(10,10,200,200,rgb@(30,255,30))
call draw_filled_rectangle@(100,50,120,60,rgb@(255,0,30))
call draw_filled_rectangle@(400,400,600,5000,rgb@(30,0,255))

draw_simulation=2
end function
Back to top
View user's profile Send private message
John-Silver



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

PostPosted: Sun Apr 22, 2018 7:28 pm    Post subject: Reply with quote

Thank's for your input Dan.

Yes the 0 values for the function explain why when clicking on any window i closes as you say.
I'd just copied that staright from Rudnei's original code.
This question of what values a clearwin function should be set to has always confused the hell out of me.
A good explanation somewhere in the documentation would be useful. Cue Paul to tell me t's already there and where !?

Quote:
1) each callback calls select_graphics_object@ function before doing any drawings


I'd also already tried that and as in your version it didn't have any impact. The graphic regions handles are all ZERO as I mentioned before.

I see now that just clicking on any of the other windows also redraws it's contents to the 'simulation' window.

There's obviously some subtlety here that we're missing and only Paul would know about.
_________________
''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
LitusSaxonicum



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

PostPosted: Tue Apr 24, 2018 10:05 pm    Post subject: Reply with quote

The reason why all the %gr area control handle variables are zero is that is what you set them, by default. Unlike most controls' handles, which RETURN a handle, the handles for a %gr area have to be GIVEN. When I discovered this, some years ago, I wrote a post entitled 'When is a handle not a handle'.

At least, if you specified:

ihgw_control_panel = 10
ihgw_control_bar = 20
ihgw_simulation =30

before starting the Clearwin+ code, then you can determine which area to draw to with select_graphics_area@. As it is written, all three are graphics handle zero!

It may not be the complete answer, but it is part of it.

To summarise: The handle for %gr must be different for each %gr area, and you specify it, it isn't returned from Clearwin+

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



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

PostPosted: Wed Apr 25, 2018 12:20 am    Post subject: Reply with quote

Eddie, You are right.
Damn, after some time of not using i always forget that. Paul has to rename this in HELP from "handle" to "user-defined number" and stress that if it wasn't already done so. Here is complete text. Must be in extended collection of examples for Clearwin if Silverfrost is interested in increase of compiler users base
Code:

winapp
program test_mdi1
include <windows.ins>

integer      :: i1,i2,i3,i4, ixF, iyF, rslt, ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation
integer iT, iTextUnit
integer, external :: draw_control_panel, draw_display_bar, draw_simulation

common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation

ixF=1100
iyF=1000
iTextUnit=2 ! was 0 before version 8.30

ihgw_control_panel = 11
ihgw_display_bar   = 12
ihgw_simulation    = 13

i1=winio@('%ww[no_border]%es&')
i1=winio@('%ca[Main Window containing an MDI frame]&')
i1=winio@('%pv%fr%lw',ixF,iyF, ihgw_main_window)


iT=winio@('%aw%ww[no_border]%ca[Text Window]%pv%40.8cw', &
ihgw_main_window, iTextUnit )

i2=winio@('%aw%ww[no_border]%ca[Control Panel]%pv%`^gr[black,user_resize]', &
ihgw_main_window, 300,200,ihgw_control_panel, draw_control_panel )

i3=winio@('%aw%ww[no_border]%ca[Display Bar]%pv%`^gr[white,rgb_colours,user_resize]', &
ihgw_main_window, 500,400, ihgw_display_bar, draw_display_bar )

i4=winio@('%aw%ww[no_border]%ca[ihgw_simulation]%pv%`^gr[black,user_resize]', &
ihgw_main_window, 800,800, ihgw_simulation, draw_simulation )

!... Text window
Print*, 'This is Text window'

end program test_mdi1

!..............................................................
integer function draw_control_panel ()
include <windows.ins>
common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation

i44=select_graphics_object@(ihgw_control_panel)

call draw_filled_ellipse@(100,100,80,80,rgb@(127,59,30))

draw_control_panel=2
end function

!..............................................................
integer function draw_display_bar ()
include <windows.ins>
common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation

i44=select_graphics_object@(ihgw_display_bar)

call draw_filled_rectangle@(2,2,398,398,rgb@(255,255,30))

draw_display_bar=2
end function

!..............................................................
integer function draw_simulation ()
include <windows.ins>
common /GR_areas_ids/ihgw_main_window, ihgw_control_panel, ihgw_display_bar, ihgw_simulation

i44=select_graphics_object@(ihgw_simulation )

call draw_filled_rectangle@(10,10,200,200,rgb@(30,255,30))
call draw_filled_rectangle@(100,50,120,60,rgb@(255,0,30))
call draw_filled_rectangle@(400,400,600,5000,rgb@(30,0,255))

draw_simulation=2
end function


Last edited by DanRRight on Wed Apr 25, 2018 4:00 am; edited 1 time in total
Back to top
View user's profile Send private message
rudnei



Joined: 29 Dec 2011
Posts: 31

PostPosted: Wed Apr 25, 2018 1:20 am    Post subject: Reply with quote

Many thanks for your help!
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Apr 25, 2018 7:40 am    Post subject: Reply with quote

Quote:
Paul has to rename this in HELP


I have now made some further changes to try to make this clear.
Back to top
View user's profile Send private message
John-Silver



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

PostPosted: Wed Apr 25, 2018 8:52 am    Post subject: Reply with quote

The "Niagara Falls' of all ClearWin Knowledge strikes again !!!
Thank you very much indeed eddie Smile

Indeed I remember that post (now you mention it ans with a little help from Mr. Google (the phpBB forum searcher being quite frankly pretty rubbish§) here is it's link:
http://forums.silverfrost.com/viewtopic.php?t=1372&sid=15d926b7971cc16f22a6b1afe39f1d8a

Plato-nicusSaxonicum Wink even going so far as to sum it all up with the brilliant:
Quote:
All handles are created equal, but some handles are more equal than others

_________________
''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
LitusSaxonicum



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

PostPosted: Wed Apr 25, 2018 11:18 am    Post subject: Reply with quote

Dan,

It is still a handle. Windows gives you a handle, you give Clearwin+ graphics a handle.

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



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

PostPosted: Wed Apr 25, 2018 3:48 pm    Post subject: Re: Reply with quote

LitusSaxonicum wrote:
Dan,
It is still a handle. Windows gives you a handle, you give Clearwin+ graphics a handle.


Due to either "handle" word or design faults several people were unable to resolve simplest thing for a week. Of course this puts users away from Clearwin.

My question: why this handle was made this way as apposed to other handles? Why user has to be present here as a middleman? This confusion takes debug time and has no visible reasonability. Let's Windows set the value itself, do we miss with this anything?

Second, this bug would be easily found if Clearwin ALWAYS (with and without /undef or /checkmate) checked ALL input data on undefined status. Not doing this I find as a big design mistake. Nobody cares if GUI will be 1 microsecond slower. As probably everyone now knows well that FTN77/95 demonstrated that any compiler without checking for all undefined stuff is a pure garbage. Clearwin+ though decided to go against of its own ideology causing us a lot of lost debug time and itself the lost users base.


Last edited by DanRRight on Thu Apr 26, 2018 2:47 pm; edited 1 time in total
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  Next
Page 2 of 3

 
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