Topic: Aplot axes labels?

Hi Jeff,

Is it possible to add a menu option to Aplot that would allow the axes and title labels to be revised while in the application?  I realize that this may not be feasible, but perhaps there is a work around.

I believe that I may have asked this question before, so expecting the answer is no.

Thanks for all you support,
Frank

Re: Aplot axes labels?

Frank,

At this time, no, it isn't possible.  However, we are adding some substantial functionality to Aplot and AppGraphics on Windows with the next release that should allow you to add the feature a bit more manually.  The release should be out this week (I'm working on some minor issues with documentation, macOS problems, etc. as I type this).  I'll try to get a blog post together about the new feature.  Basically, it introduces a new Aplot call, embed_plot that should provide the flexibility you need.

Jeff Armstrong
Approximatrix, LLC

Re: Aplot axes labels?

Jeff,

Indeed a very nice treat for Halloween.  Thank you so much! smile

Frank

Re: Aplot axes labels?

Frank,

I still need to write up a good post about using some new Aplot features, but the new embed_plot call might be what you're looking for in Simply Fortran 3.26.  You can read about it at the bottom of the Aplot reference page under Windows-Specific Functionality.  I should have an example up in the next day or two.

Jeff Armstrong
Approximatrix, LLC

Re: Aplot axes labels?

Hi Jeff,

Thank you for adding functionality to the Windows Aplot graphing application. I look forward to applying this new feature and reviewing your informative example program of how it interfaces smoothly with AppGraphics.

Thanks again for all your effort in continually improving SimplyFortran.

Frank

Re: Aplot axes labels?

Frank,

We have our post up at https://simplyfortran.com/blog/10/.

Jeff Armstrong
Approximatrix, LLC

Re: Aplot axes labels?

Hi Jeff,

I implemented the embed_plot procedure to embed an Aplot in one of my SF graphics programs and it worked as expected with no issues.  Your example was easy to understand and allowed the straight forward incorporation of embed_plot in my program. In addition, the inclusion of menus to change axes labels in the AppGraphics windows was straight forward. The only issue I encountered was the use of 'closeflag' in the AppGraphics 'initwindow' function. When the 'X' in the upper right hand corner of the graphics child window was selected, it always closed both the child window and the parent window. In order to maintain an active parent window, the 'setwindowsystemclosecallback' procedure was used to disable the 'X' in the child window. This solved the problem so that the parent window stayed active.

Please note that SF 'Help/AppGraphics/Window Management' has a typagraphical error in the 'setwindowsystemclosecallback' reference (see below).

setwindowsystemclosecallback
C void setwindowclosecallback (callback)    <--- setwindowsystemclosecallback
Fortran subroutine setwindowclosecallback (callback)   <--- setwindowsystemclosecallback

Thank you again for all your effort and time in adding these new features to SF.

Frank

Re: Aplot axes labels?

Hi Jeff,

Thank you adding the Aplot embedding feature to SF. In my previous message I wrote, "The only issue I encountered was the use of 'closeflag' in the AppGraphics 'initwindow' function. When the 'X' in the upper right hand corner of the graphics child window was selected, it always closed both the child window and the parent window. In order to maintain an active parent window (when closing the child window), the 'setwindowsystemclosecallback' procedure was used to disable the 'X' in the child window. This solved the problem so that the parent window stayed active.".

Regarding the issue of the "X" in the upper right corner of the window, I was wondering whether it could be "grayed out" or even removed when the "setwindowsystemclosecallback" procedure is used to make the "X" inactive?  I ask this question because I always seem to be selecting the "X" to close windows since it looks like all the other window "X's" that are active. 

Is it feasible to "gray out" or remove it when inactive?

Frank

Re: Aplot axes labels?

Frank,

To the best of my knowledge, you can't actually disable the Close button on a window without actually changing some rather basic aspects of how the window functions/looks.  All you can do is catch and stop it.

Your messages mentioned that you've set closeflag to .true., which is causing everything to terminate.  I honestly don't enable closeflag very often as it terminates the program entirely.  It might be better to start setting it to .false. everywhere.  When a window closes, your program could just cleanly handle the closing procedure.  At the very least, I would definitely set closeflag to .false. on these child plot windows to avoid the program terminating when they close or your having to implement the setwindowsystemclosecallback handler.

Thank you for letting me know about the typo!

Jeff Armstrong
Approximatrix, LLC

Re: Aplot axes labels?

Jeff,

Thank you for your suggestion to set all closeflags to .FALSE.  I have now set the closeflag of all windows (parent and childs) to 'closeflag=.FALSE..  However, setting the closeflag to .FALSE. is not preventing the parent and child windows of Appgraphics from closing when the 'X' is selected. I've only been successful in inactivating the 'X' when setwindowsystemclosecallback is used. Clearly, I must be doing something wrong, but till now I've not been able to identify the problem.  Although this not a big problem and the setwindowsystemclosecallback fixes it, I will continue to explore why closeflags set to .FALSE. do not prevent my windows from closing.

The following is the code I used to inactivate the windows 'X' (This approach works perfectly.).
        !///////////////////////////////////////////////////////////////
        !--- Get main window that signalled the child window
        idActiveWin = getsignallingwindow()

        !--- Create AppGraphics plot window
        !--- function initwindow (width, height, title, left, top, dbflag, closeflag)
        myscreen2 = initwindow(510, 440, 'Plot Data', closeflag=.FALSE.)

        !--- Set font style to Sans Serif
        call settextstyle (SANS_SERIF_FONT, HORIZ_DIR, 14)

        !--- TURN OFF THE CLOSEFLAG 'X' IN THE CHILD WINDOW
        !--- Sets a callback procedure to be called when the
        !--- user clicks the “X” (close button) in the upper corner
        !--- on a window or selects “Close” in the window’s system
        !--- menu. The callback should be a simple function that
        !--- returns 0 if the window is to be kept open, or 1 if
        !--- the window should close.
        !--- The callback is IGNORED if the window was created with
        !--- closeflag set to TRUE in the initwindow call'
        !---
        !--- When the Initwindow closeflag=.TRUE.and the call to
        !--- setwindowsystemclosecallback 'closeflag-active', the user
        !--- is asked 'Yes/No' whether to terminate the entire program.
        !---call setwindowsystemclosecallback (closeflag_active)
        CALL setwindowsystemclosecallback (closeflag_cancel)
        !///////////////////////////////////////////////////////////////

I'm sure you'll let me know if you have any further suggestions; otherwise I'll keep exploring.

Thanks,

Frank