Topic: Setting Up and Using AppGraphics

I am looking at the addition of the AppGraphics package as something that I can use to build a simple GUI interface for my FORTRAN project. I noted that the package management SW requires a subscription and since my project is just a hobby, I really can't justify the cost of that management package.

Can someone help me with some directions on how to extract and install this package and other related dependent packages into my SimplyFortran environment so that I can begin to use these calls to build a GUI? Feeling like not the brightest bulb in the box about this but searching the forum didn't really turn up anything that helps with getting these packages included in SF (Although I could have missed it as my wife claims I have man's disease, "not seeing what is right in front of your face").

Jeff's interface that was recently put up on the development blog looks like a great starting point for what I would like to build.

Thanks in advance!

Re: Setting Up and Using AppGraphics

AppGraphics comes with every copy of  Simply Fortran.  You don't need to install anything else, and you don't need an SF Package Manager subscription.  It's already included with your installation.

If you have the most up-to-date version of Simply Fortran (version 2.21 build 1837 at this time), you can compile AppGraphics programs without any additional effort.  To use the code at the blog, you only need to download the file at the end of post, start a new project in Simply Fortran, add the file, and hit Build Now! in the Build menu.  There are no other requirements, and it should just work (let me know if it doesn't, though).

Modern versions of Simply Fortran also have a sample project, "Conway's Game of Life," that shows a more complex usage of AppGraphics.  I suggest you select that example from the Start panel after starting Simply Fortran and try building it.

If you do have more specific questions about AppGraphics, please feel free to ask!

As for packages listed at the SF Package Manager website, they cannot be downloaded without a subscription.  Almost all are open-source, though, so you could try building them yourself.  It tends to be unpleasant to do so for many of them under Windows, which is why we provide the service.

Jeff Armstrong
Approximatrix, LLC

Re: Setting Up and Using AppGraphics

Yeah, clearly I am not the brightest bulb! Sorry for dumb question. I am using SF 2.19, so I will need to download the latest version to get started.

I am excited to be able to put a modern GUI wrapper around my code, but not too excited as I really don't like programming. Saying that must be sacrilege on this site. LOL!

Thanks again Jeff!

Rod

Re: Setting Up and Using AppGraphics

Rod,

It's not a dumb question.  I'm not sure we really explain that AppGraphics is included all that well.  Definitely get the latest version of Simply Fortran, though!  There should be plenty of bug fixes in the newer version too.

Jeff Armstrong
Approximatrix, LLC

Re: Setting Up and Using AppGraphics

I just wanted to update this post. I downloaded the latest version and began checking out the examples. As I became somewhat comfortable with the calls and usage, I began hacking my way into building a data plotting program. I spent most of Saturday and half of Sunday (much to the wife's dismay) building slowly what ended up as being an interesting new version of my data plotting tool. This tool is something that will immediately replace the previous tool (made with a 1997 version of MS FORTRAN) and more useful in some ways now.

I have much more I want to do, adding some features and cleaning up the look but overall, I am really happy with what I was able to create in a short period of time. The AppGraphics package isn't the most full featured but it looks like it is well suited for what I will use it for.

I still have some questions about usage and will update this when I have more time. That said, just a big "Thank You SimplyFortran!"

Rod

Re: Setting Up and Using AppGraphics

Rod,

I'm glad you've found AppGraphics useful!   It is definitely no a "full-featured" GUI framework,  but we're trying to include some of the most common GUI elements that people might want. It is designed to be simple first and foremost, and features have to fit that goal when added.  If you do think of anything that could or should be added, please let us know!  We've had a number of requests thus far, but a few, like plotting or table views of numbers, are quite complex to implement properly and simply.

Could you be persuaded to share a screen capture of what you've created?   I think myself and others would like to see!

Jeff Armstrong
Approximatrix, LLC

Re: Setting Up and Using AppGraphics

Jeff,

I have worked on this a bit since the last post and I uploaded a screen capture to my Flickr site. It is still pretty crude from the user perspective but since I am the only one who will use it, it doesn't matter right now. However, its utility for what I need is really nice right now. I will be adding more at some point. I also note that there is the ability to save graphics and as I have made videos of my simulation results in the past and want to continue to do that. I haven't checked into it completely but if there is a way to get a screen capture from inside the code, then I can dump BMP files at regular time intervals and build up the video that way. That is definitely for the future.

Currently, what this program does is read data files that were created from my simulation and plots the x,y and z coordinates in two plot windows x-y on the left and z-y on the right. The data is continually updated so positions on the screen  are like looking at an animation of their motions. The controls at the top allow me to from left to right:

Create offsets for the x-y-z coordinates (positive or negative)
Speed up or slow down the animation but reading the data files at a larger increment
Zoom in or out by changing the plotting scale
Reverse the time direction, forwards or backwards in time.

I can't figure out how to put the image in this message, so there is a link to it on my Flickr site below.

https://www.flickr.com/photos/grogley/16657689950/

As I said earlier, I am an awful programmer and I would never show my code for this because I would be too embarrassed (LOL). I mean I really hacked my way through this, testing about every small change just to see what it would do.

Rod

Re: Setting Up and Using AppGraphics

Rod,

The user interface looks sharp!  You can't actually post pictures via this forum.  They have to be hosted elsewhere, and Flickr doesn't allow direct linking to photos, so the link you've provided will do.

You can capture and save bitmaps from code.  The writeimage subroutine does what you'd like.  The only caveat at this time is writeimage and the other image capturing calls will only write out the graphics you create; window controls, like buttons and text boxes, will be excluded.

Jeff Armstrong
Approximatrix, LLC

Re: Setting Up and Using AppGraphics

Thanks Jeff. Still lots of work to do.

Not as slick as I would like. I can't figure out for the life of me how to justify the text box numbers to the right of the box. The settextjustify subroutine only seems to work on the text outside the text boxes.

Also, I have defined plotting viewports and such, is there anyway to switch between these viewports without having to use the setviewport call? I tried using the get and setactivepage calls but that didn't seem to affect the viewports.

Thanks for your help.

Rod

Re: Setting Up and Using AppGraphics

Rod,

Right now, the settextjustify routine indeed only affects text written using outtext and outtextxy.   It does make sense, though, to have it apply to text boxes.  It will do so in the next version.

You do have to use a complete setviewport call each time  to switch viewports.  It's not ideal, but you could probably write your own wrapping subroutines like setviewport1 and setviewport2.  The setactivepage and related routines are present to provide fine-grained control over double-buffering, which is not what you're trying to achieve.

Jeff Armstrong
Approximatrix, LLC

Re: Setting Up and Using AppGraphics

Jeff,

About the text justification, if you can include that in a future version, that would be great. I can live with the viewport selection method, it just feels a bit clumsy.

I have added many more features and a bit more to the GUI. I will probably update the photo link at some point but I need to do a bit of cleanup and give more thought to positioning these text boxes and a check box.

Thanks again and I really am pleased with this package for my use.

Rod

Re: Setting Up and Using AppGraphics

Rod,

The development version of AppGraphics now sets the text box justification to match the last specified settextjustify.  The one restriction, however,  is that the justification cannot be changed after the text box is created.  This restriction is due to Windows, not AppGraphics.   So the call  would proceed something like:

    call settextjustify(CENTER_TEXT, CENTER_TEXT)
    textbox = createtextbox(100, 80, 100, 20)
    call settextboxcontents(textbox, "Testing!")

to center the text.  I think the above makes sense.

Jeff Armstrong
Approximatrix, LLC

Re: Setting Up and Using AppGraphics

Thanks Jeff for implementing the text box justification. That implementation should work fine for my purposes. When will that be incorporated into the SF release?

Just an FYI, I update the screen shot of my plotting program that shows the initial work up a center-of-mass plot option. The new feature works, I just haven't finalized the position of the text boxes and check box. I also need to add some text around how these additions are used. Here is the link to the screen capture if you are interested.

https://www.flickr.com/photos/grogley/16657689950/

Re: Setting Up and Using AppGraphics

Rod,

Version 2.23 was released today, and it integrates text box justification:

http://simplyfortran.com/download/

Let me know if you encounter any issues!

Jeff Armstrong
Approximatrix, LLC