 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
DanRRight

Joined: 10 Mar 2008 Posts: 1776 Location: South Pole, Antarctica
|
Posted: Mon Apr 16, 2018 11:22 pm Post subject: |
|
|
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 |
|
 |
John-Silver
Joined: 30 Jul 2013 Posts: 754
|
Posted: Wed Apr 18, 2018 10:28 pm Post subject: |
|
|
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. _________________ "This is the triumph of folly.
The machine, which knows no rest, ought to remain a tool,
... but instead becomes our master and will swallow up our life and soul"
Last edited by John-Silver on Fri Apr 20, 2018 5:44 am; edited 3 times in total |
|
Back to top |
|
 |
DanRRight

Joined: 10 Mar 2008 Posts: 1776 Location: South Pole, Antarctica
|
Posted: Thu Apr 19, 2018 1:55 pm Post subject: |
|
|
Hell knows, way to many options to try. Needs more swearing time. This is why i use word 'devilry' too often. |
|
Back to top |
|
 |
John-Silver
Joined: 30 Jul 2013 Posts: 754
|
Posted: Fri Apr 20, 2018 2:49 pm Post subject: |
|
|
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 ........ _________________ "This is the triumph of folly.
The machine, which knows no rest, ought to remain a tool,
... but instead becomes our master and will swallow up our life and soul" |
|
Back to top |
|
 |
John-Silver
Joined: 30 Jul 2013 Posts: 754
|
Posted: Fri Apr 20, 2018 2:54 pm Post subject: |
|
|
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 |
_________________ "This is the triumph of folly.
The machine, which knows no rest, ought to remain a tool,
... but instead becomes our master and will swallow up our life and soul" |
|
Back to top |
|
 |
John-Silver
Joined: 30 Jul 2013 Posts: 754
|
Posted: Fri Apr 20, 2018 3:30 pm Post subject: |
|
|
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 ? _________________ "This is the triumph of folly.
The machine, which knows no rest, ought to remain a tool,
... but instead becomes our master and will swallow up our life and soul" |
|
Back to top |
|
 |
DanRRight

Joined: 10 Mar 2008 Posts: 1776 Location: South Pole, Antarctica
|
Posted: Sat Apr 21, 2018 11:27 am Post subject: |
|
|
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 |
|
 |
John-Silver
Joined: 30 Jul 2013 Posts: 754
|
Posted: Sun Apr 22, 2018 7:28 pm Post subject: |
|
|
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. _________________ "This is the triumph of folly.
The machine, which knows no rest, ought to remain a tool,
... but instead becomes our master and will swallow up our life and soul" |
|
Back to top |
|
 |
|
|
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
|