|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2390 Location: Yateley, Hants, UK
|
Posted: Tue Jan 15, 2008 5:24 pm Post subject: Do %pm menus work for clicking in a %gr region? |
|
|
Just a quick check - my reading of the documents suggests that %pm menus don't work when the mouse is over a control, and it seems from my first go that they don't work in a %gr. Is this the case - or is there some setting in %gr to enable them please? (Popping up a set of buttons - which is what I'm doing - is ugly).
Eddie
Aha! just found "display_popup_menu@", so found the answer ! Is there no end to the complexities of ClearWin? |
|
Back to top |
|
|
wosl
Joined: 31 Jan 2008 Posts: 30
|
Posted: Sat Apr 19, 2008 10:59 pm Post subject: |
|
|
I'm facing with the same problem.
%pm doesn't work in a %gr area, The activation of %pm with display_popup_menu@ displays the pop up menu only when the mouse is not over the %gr area.
Any idea?
WoSl |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Sun Apr 20, 2008 8:39 am Post subject: |
|
|
It may be necessary to use the %gr option that enables mouse input [full_mouse_input]. If this does not work, post some sample code and I will check it out. |
|
Back to top |
|
|
wosl
Joined: 31 Jan 2008 Posts: 30
|
Posted: Sun Apr 20, 2008 12:43 pm Post subject: |
|
|
Attached please find some sample code. The pop-up menu %pm appears only if the mouse cursor hovers the top border of the main window. In other words, if the mouse cursor is leaving the %gr graphics area: cursor type changes from "cross" to "arrow".
FTN95 version: 5.01, compiled in full debug mode.
Any help is very much appreciated.
WoSl
Code: |
winapp
program test
c Test pm menus
implicit none
include <windows.ins>
external Df
integer s_width,s_depth,g_width,g_depth
integer i
integer ibgcol
integer hwin,ictrl,ihnd_grap
c Main Window
ibgcol=RGB@(138,185,215)
s_width=clearwin_info@ ('SCREEN_WIDTH')
s_depth=clearwin_info@ ('SCREEN_DEPTH')
g_width=s_width*0.85
g_depth=s_depth*0.85
c
i=winio@ ('%ww[no_border]%ca[Test PM Menu]&')
i=winio@ ('%bg&',ibgcol)
i=winio@ ('%pm[Copy]&',Df)
i=winio@ ('%pm[Cut]&',Df)
i=winio@ ('%pm[Paste[Below]]&',Df)
i=winio@ ('%pm[[Left]]&',Df)
i=winio@ ('%pm[[Right]]&',Df)
i=winio@ ('%pm[Delete]&',Df)
i=winio@ ('%mn[Copy]&',Df)
i=winio@ ('%mn[Cut]&',Df)
i=winio@ ('%mn[Paste[Below]]&',Df)
i=winio@ ('%mn[[Left]]&',Df)
i=winio@ ('%mn[[Right]]&',Df)
i=winio@ ('%mn[Delete]&',Df)
i=winio@ ('%mn[Exit]&','EXIT')
i=winio@ ('%pv%`gr[rgb_colours,full_mouse_input]&',
* g_width,g_depth, ihnd_grap)
i=winio@ ('%hw&',hwin)
i=winio@ ('%lw',ictrl)
c
stop
end
integer function Df ()
c Do-nothing-call back routine
Df=1
return
end
|
|
|
Back to top |
|
|
wosl
Joined: 31 Jan 2008 Posts: 30
|
Posted: Sun Apr 20, 2008 12:50 pm Post subject: |
|
|
Sorry, I forgot to add in my sample code the
call display_popup_menu@ ()
function. The result is the same (no pop-up menu). I copied it right after the last winio@ command. Is this the right place?
WoSl |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Sun Apr 20, 2008 1:37 pm Post subject: |
|
|
Piece of cake lads!
Create a callback for the graphics region. Use 'CALLBACK_REASON' of CLEARWIN_STRING@ and if RIGHT_MOUSE_CLICK then call DISPLAY_POPUP_MENU@
See modified example.
Regards
Ian
Code: |
winapp
program test
c Test pm menus
implicit none
include <windows.ins>
external Df,MOUSE_CLICK
INTEGER MOUSE_CLICK
integer s_width,s_depth,g_width,g_depth
integer i
integer ibgcol
integer hwin,ictrl,ihnd_grap
c Main Window
ibgcol=RGB@(138,185,215)
s_width=clearwin_info@ ('SCREEN_WIDTH')
s_depth=clearwin_info@ ('SCREEN_DEPTH')
g_width=s_width*0.85
g_depth=s_depth*0.85
c
i=winio@ ('%ww[no_border]%ca[Test PM Menu]&')
i=winio@ ('%bg&',ibgcol)
i=winio@ ('%pm[Copy]&',Df)
i=winio@ ('%pm[Cut]&',Df)
i=winio@ ('%pm[Paste[Below]]&',Df)
i=winio@ ('%pm[[Left]]&',Df)
i=winio@ ('%pm[[Right]]&',Df)
i=winio@ ('%pm[Delete]&',Df)
i=winio@ ('%mn[Copy]&',Df)
i=winio@ ('%mn[Cut]&',Df)
i=winio@ ('%mn[Paste[Below]]&',Df)
i=winio@ ('%mn[[Left]]&',Df)
i=winio@ ('%mn[[Right]]&',Df)
i=winio@ ('%mn[Delete]&',Df)
i=winio@ ('%mn[Exit]&','EXIT')
i=winio@ ('%pv%`^gr[rgb_colours,full_mouse_input]&',
* g_width,g_depth, ihnd_grap, MOUSE_CLICK)
i=winio@ ('%hw&',hwin)
i=winio@ ('%lw',ictrl)
c
stop
end
integer function Df ()
c Do-nothing-call back routine
Df=1
PRINT *,'IN CALLBACK'
return
end
integer function MOUSE_CLICK ()
USE CLRWIN
c Do-something-call back routine FOR GRAPHICS REASON
CHARACTER*80 REASON
REASON=CLEARWIN_STRING@('CALLBACK_REASON')
MOUSE_CLICK=1
SELECT CASE(REASON)
CASE('MOUSE_RIGHT_CLICK')
C PRINT *,'IN CALLBACK RIGHT MOUSE_CLICK'
CALL DISPLAY_POPUP_MENU@()
END SELECT
return
end
|
|
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Sun Apr 20, 2008 1:56 pm Post subject: |
|
|
And these bits may help:
Note a RESIZE is detected when the original window is opened and so the draw/redraw could be placed in the callback, first time, nothing to redraw.
It would be normal to use a %sc to do an initial draw, and this kills two birds...
Ian
Code: |
.
.
.
i=winio@ ('%pv%`^gr[rgb_colours,full_mouse_input,user_resize]&',
* g_width,g_depth, ihnd_grap, MOUSE_CLICK)
.
.
.
integer function MOUSE_CLICK ()
USE CLRWIN
INTEGER X,Y
c Do-something-call back routine FOR GRAPHICS REASON
CHARACTER*80 REASON
REASON=CLEARWIN_STRING@('CALLBACK_REASON')
MOUSE_CLICK=1
SELECT CASE(REASON)
CASE('MOUSE_RIGHT_CLICK')
C PRINT *,'IN CALLBACK RIGHT MOUSE_CLICK'
CALL DISPLAY_POPUP_MENU@()
CASE('RESIZE')
PRINT *,'REASON ',TRIM(REASON)
x=clearwin_info@('GRAPHICS_WIDTH')
y=clearwin_info@('GRAPHICS_DEPTH')
PRINT *,'New size',x,y
END SELECT
return
end
|
|
|
Back to top |
|
|
wosl
Joined: 31 Jan 2008 Posts: 30
|
Posted: Sun Apr 20, 2008 3:35 pm Post subject: |
|
|
Many thankx Ian!
It works now. My error has been that I need to call the display_pop_menu@ every time clicking on the right mouse button. I did it only during the initialization.
I understood the recommendation to use %sc. But I didn't get your second point in respect to "resize". It's okay to put the "user_resize" parameter into the %gr options, but what is the relation to the pop up menu?
Would appreciate a short comment to free up my deadlock!!
Wosl |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Sun Apr 20, 2008 4:18 pm Post subject: |
|
|
The "RESIZE" comment was because you had applied a %pv to the %gr code so that the window could be resized. If you omit the "user_resize" option, then you have no way of knowing that the change to the area has been made and the display will most likely not work properly. You may want to change the scaling of the user coordinates to the pixel coordinates when a "RESIZE" occurs, and a re-draw would then be required.
It has absolutely nothing to do with the popup menus, except that the two actions will be handled by the same callback.
Actually, I was just bored and got a bit carried away! But it will no doubt come in handy for my graphics programs.
Regards
Ian |
|
Back to top |
|
|
wosl
Joined: 31 Jan 2008 Posts: 30
|
Posted: Sun Apr 20, 2008 4:51 pm Post subject: |
|
|
Thank you Ian!
I've the "user_resize" in my original code but didn't copy it to my sample.
I've some problems with graphics resizing. But I'll post this issue after some additional testing as a separate topic in order not to bore other forum members too much.
Great support - Thank you.
WoSl |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2390 Location: Yateley, Hants, UK
|
Posted: Sun Apr 20, 2008 5:18 pm Post subject: |
|
|
At the level of a simple %pm, you don't even need full_mouse_input for the popup menus to work. As I recall, you can hang the popup menu onto any event, not simply a right-click.
I found that enhanced popup menus required full_mouse_input, and the side effects of this plus some other curious behaviour made me abandon Clearwin popup menus altogether (whether of the plain or enhanced kind). Since you can do lots of other things in response to a click, I have been popping up simple windows with
IA=WINIO@('%ww[no_maxminbox,no_caption,no_frame]&')
IA=WINIO@('%ww[casts_shadow,volatile]&')
IA=WINIO@('%sy[3d_thin,thin_border,toolwindow]&')
(some of which I probably don't need) - these windows can have buttons, input boxes, %ib or %tb buttons etc etc).
There is no doubt, however, that the %pm menus are elegant, and your example (which I just tried out) has encouraged me to go back and work out what the heck I was doing wrong last time round.
Eddie |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2556 Location: Sydney
|
Posted: Tue Apr 22, 2008 3:06 am Post subject: |
|
|
As an alternative, I use full_mouse_input in a %gr environment, but do not use %pm ( I never thought to). Instead I create a new child window with %winio, similar to a window that responds to a menu selection. I have all the functionality of a normal menu response, whose layout and questions can easily change depending on settings that are present when the mouse click is made.
%pm may be a good solution but a more general %winio window does provide an alteranative "pop-up" response to a mouse click.
John |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2390 Location: Yateley, Hants, UK
|
Posted: Tue Apr 22, 2008 7:16 pm Post subject: |
|
|
Hi John,
I do exactly as you do, (I guess).
%pm produces an extremely nice pop up menu (as does the enhanced version), with a nice border, and with a very elegant drop shadow. (Drop shadows on ordinary windows in Clearwin are quite crude, and they are "volatile" with focus loss). However, I found by dint of trial that the standard %pm didn't work properly with greying out of options etc without full_mouse_input, and enhanced %pm wouldn't work at all without it.
I have an aversion to full_mouse_input based on some bug in my code I can't get rid of if I enable it. I have tried to emulate the nice appearance of %pm by using appropriately designed %ib button arrays, and you can do it - at least my trial worked - but I haven't added it to my programs because of other more pressing work.
%pm menus suffer the limitations of menus - you can't enter a value, for instance.
I do intend to return to %pm when I have time. It jkust seems to be the right way to do the job.
Eddie |
|
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
|