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 

Hello ClearWin+
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Jan 06, 2011 12:47 pm    Post subject: Reply with quote

I can't answer all your questions:
1. I get confused also, sometimes you you supply or receive a handle. an example that might help is:
SUBROUTINE GET_WINDOW_LOCATION@( HANDLE, X, Y, WIDTH, HEIGHT)
INTEGER HANDLE, X, Y, WIDTH, HEIGHT

Description
HANDLE is a window handle obtained, for example, by using %hw or %lc. Other arguments are returned with the pixel coordinates and dimensions of the window.

2. See The OPTIONS directive, as it is a way of specifying /INTL, which is the default anyway.

3. sleep@ expects a single precision real
call sleep (40.0)

John
Back to top
View user's profile Send private message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Thu Jan 06, 2011 1:14 pm    Post subject: Reply with quote

Hi John,

thanks. With the sleep I tried 40 and 40.0D0 (not 40.0) - typical Murphy.

I tried the GET_WINDOW_LOCATION@: for the code below there will be 2 windows at the same time, i.e. two handles should be available. However, the subroutine (as given in the example) returns the following:
0 12558 4 -12491 56884468
0 12558 4 -12491 12554

Since the two windows are active at the same time one would expect different values for HNDL1 and HNDL2.

PS: Since I have Matlab as a reference (handle is automatically returned) it might be that I have the wrong concept (or expectation) from ClearWin+

Code:
      K=1
      CALL INITIAL_SPLASH
      CALL GET_WINDOW_LOCATION@( HNDL1, X, Y, WIDTH, HEIGHT)
      write(*,*) HNDL1, X, Y, WIDTH,HEIGHT
      K=2
      CALL INITIAL_SPLASH
      CALL GET_WINDOW_LOCATION@( HNDL2, X, Y, WIDTH, HEIGHT)
      write(*,*) HNDL2, X, Y, WIDTH,HEIGHT
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Thu Jan 06, 2011 3:49 pm    Post subject: Reply with quote

OPTIONS (INTL) is a way of making sure that all integers are INTEGER*4 or "Long Integers". When Fortran was invented (I was at school then), it only had implicit typing. Explicit typing was introduced later. Modern computing philosophy is to explicitly type everything. If you use implicit typing, then the OPTIONS command gives you automatically everything as "Long Integers" – hence INTL. Short integers are INTEGER*2. Even if you prefer to explicitly type everything, OPTIONS (INTL) means that just INTEGER will do, and you don't need INTEGER*4 or INTEGER (KIND=2?). When Fortran was invented, INTEGER and REAL variables had to be the same length too ....

Many Windows programs display a splash screen on entry. Microsoft Office programs do, so do programs I use a lot in the CorelDRAW graphics suite. Some smaller applications in Windows (e.g. Notepad, Paint) load so quickly that they don't need to inform the user that they are actually loading. It's the ones that load slowly that do. The little routine you used will display a splash screen. Just imagine the difference between a netbook which may have 800x600 pixels and a dual-monitor setup where each monitor may be 2560x1920. (Ignore what FTN95.CHM says about the maximum size being 1000x1000 by the way!). I have found by trial and error that the optimum time for the splash to stay onscreen is 2 seconds. If the main window takes longer to load (and it takes longer if you use %ib toolbar buttons than %tb), then the splash needs to stay up longer, and maybe it needs to do something. Why two invocations give you the same handle is a mystery - Clearwin is full of them. Only Paul knows the answer!

If you exit windows with the standard callback 'EXIT', you get "instant death". This may be OK for something you are testing, but if you have a real user, they will get pretty upset by this if they lose a lot of work. FTN95 has another standard callback called 'CONFIRM_EXIT'. It is a bit better than 'EXIT', because at least it asks the user to say whether they really wanted to exit or not. However, if they say "No", then what? They just get taken back to where they were working – without any reminder to save before they exit should they try again.

The standard windows way is not to ask "Are you sure that you want to exit (Y/N)?" but to say "Would you like to save your files before you exit (Y/N)?". There's a subtle difference here. In the first method the user might say "Yes, I do want to exit". That is not the same as "Yes, I do want to exit, and I want my work thrown away if I forgot to save it first". Hence, you can't use a standard callback in code that you want people experienced in the normal way that windows works – because sooner or later, they will be irritated by the difference.

You have to handle exits gracefully. That means putting a callback on the File|Exit menu to handle the case that a user didn't save before they exit. In the longer term, you also need to handle the case that Windows shuts down and the program is forced to close. You also need to handle the case that the user shuts down the program by using the close box at top right of the caption bar. Now here's the difficulty. If your callback function says "Do you want to save your file first (Yes/No/Cancel)?" what do you do in response to the options – and also what do you do if the user clicks the close box on the pop-up window?

For Yes, you go into the file save routine. But at any time during this, the user can decide not to save. Moreover, in a modern networked system, the user may ask to save in a forbidden location. If the save does not happen, what then?
For No, you can just exit. The user has already indicated that they intend to exit, and this confirms that they want to exit. That had just better not be the default!
For Cancel, you now have to decide what to do. This also applies to the close box option. Study a few working Windows programs, and you will see
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Jan 06, 2011 3:56 pm    Post subject: Reply with quote

OPTIONS(INTL) has been the default for a long time, probably since the full 32bit version of FTN77 (i.e. the one without DBOS) and certainly for all of FTN95.

If you want to revert back to 16 bit integers you can use OPTIONS(INTS) but this is not recommended.
Back to top
View user's profile Send private message AIM Address
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Thu Jan 06, 2011 8:10 pm    Post subject: Reply with quote

Thanks for the replies. I am making good progress Smile

I would like to make even more progress, however, the number of (complete windows) examples in ClearWin+ are limited. In the FTN95 Help there is examples like the factoriser - no question this is a good startting point. Where can I find more ClearWin+ examples?

When it comes to stuff like:
1.) getting the window handle;
2.) exit properly;
3.) saving files;
4.) resizing a window;
5.) etc.
things get tricky. Is it possible that Silverfrost can provide a more detailed example showing a typical windows application? This would be great!
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Jan 06, 2011 11:11 pm    Post subject: Reply with quote

I did not answer your question about "handle" clearly, as I don't fully understand this well myself.
As a comment I find the use of "Handle" is a bit vauge in clearwin+, as in some cases you provide a value for handle, defining the handle value, but in others you must inquire for the value of the handle then use it as a reference.

For a window handle, the best way may be to use %hw. I think you use this as you are creating the window, as "call winio@(‘%hw&’, handle)". It provides the handle for the current window, so hopefully the window being defined using winio@ is the current window. %lc is another winio@ option, although I'm a bit lost on the difference between %lc (last control) and %hw (current window). I think I am right in saying, get the window handle as you create the window and you can then use this handle to reference or select this window.

Cases where you provide, rather than receive a handle include "create_graphics_region@"

I hope this helps

John
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Fri Jan 07, 2011 1:15 am    Post subject: Reply with quote

John,

%hw gives us back the handle for an entire window. We often need this to do such things as close the window from "outside", or to move or position it. Sizing it is another use.

%`gr also gives us a handle - to a single graphics region - that we often need to select that graphics area if we have more than one active.

%lc gives us the handle to a specific control (e.g. a button) rather than a whole window. According to FTN95.CHM, one use is to grey a button that does not have a grey control (that didn't seem all that sensible to me, as it is more complicated than having a grey control), another use is to change the text on a button.

I looked fruitlessly through several programs to see what I had used %lc for - I was sure I had used it. Eventually I discovered it in a superceded code. I had used it to change the text on a button (once). Eventually, I decided that it was unconventional and non-intuitive, and I did the same job another way.

Presumably you have to have the control before you can find its handle, and that is why the %lc comes after the format code that created it. (A guess!).

MOVE_WINDOW@ and related routines operate on controls as well as whole windows, and if you are determined, all sorts of unconventional things are possible!

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



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Fri Jan 07, 2011 11:08 am    Post subject: Reply with quote

Thanks for the very useful tipps!

I think that it might be appropriate at this stage to motivate my interest in ClearWin+. Working a lot with FEA (and the poor commercial products) one needs to prepare input files, move and convert large amounts of data and finaly evaluate the results. For this a bit of programming skills is very helpful. Since most of our numerical code is in Fortran we use several other languages for the GUI's, i.e. Fortran is a must. Now what makes Silverfrost FTN95 so attractive? With one product one gets the following:
1.) Fortran (and C/C++) compiler;
2.) Resource compiler;
3.) ClearWin+; and
4.) an IDE (Plato).
Now if that is not enough - this is an excellent combination when one think about it! One product to get everthing done.

The preceding paragraph migt be theory from my side. However, the following software uses ClearWin+ and shows the capabilities, i.e. enough to prove that choosing ClearWin+ is perhaps not that wrong (there are several other sites which I am 80% sure that use ClearWin+).
a.) ROSHAZ
b.) NetDraw

I would guess that many other engineers are in a similar situation. If one could reduce the learning curve for ClearWin+ Perhaps Silverfrost can comment on this Very Happy
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Jan 07, 2011 3:52 pm    Post subject: Reply with quote

I guess that you have seen the Introduction, Getting Started and ClearWin+ Tutorial in the help file FTN95.chm.

See Win32 Platform->ClearWin+.

There are more examples in Documents\FTN95 Examples\clearwin.

I plan to do some work on the help file but it will not be dramatic in the short term.
Back to top
View user's profile Send private message AIM Address
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Fri Jan 07, 2011 6:33 pm    Post subject: Reply with quote

Hi Paul

Thanks for your post!

The help has quite good and helpful examples, i.e. the explanation focus on a specific command.. However, it is only bits and pieces scattered in the whole help file - at least that is my experience.

What I would like to have (or my suggestion): The bits and pieces is actually good assumed one has mastered ClearWin+ to some extend. If one could expand the factoriser to include components like:
1.) resources;
2.) proper exit (incl. the %cc);
3.) simple menu and tool bar;
4.) save and load a file;
5.) print the input;
6.) etc.
one has quite the basics of a real application.

I think that the effort for an experienced ClearWin+ programmer to give factoriser such a "face-lift" will be straightforward. This will definitely speed up the learning curve for a beginner. Which such a basis it is much easier to look up the functions in the help.

Regards
Jacques
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Sat Jan 08, 2011 12:53 pm    Post subject: Reply with quote

I'm using the products from Salford / Silverfrost since about 20 years, starting with FTN77 plus DBOS under DOS. My experience is that you should invest time and energy to learn step by step the various possibilities of this really powerful environment. Many solutions I simply found via "learning by doing" or "trial and error", and many others by discussions with and help of colleagues (or here in the forum).

I think that examples are the best way for beginners, and it might be a good idea if users could upload examples somewhere here.

Our software has the Windows "look and feel" with all of the graphics elements like icons, buttons and so on, with several kinds of graphics (raster and vector), mouse interaction and more. All of them was realised with Clearwin+, but, of course, in some cases it was a long way until the result was as it should be. About 98% of our code is written in Fortran, the rest in C using the SCC compiler.

This is a good opportunity to thank the Salford / Silverfrost team for their excellent work during decades!

Regards - Wilfried
Back to top
View user's profile Send private message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Mon Jan 10, 2011 5:20 pm    Post subject: Reply with quote

I was not sure about LISA being developed with ClearWin+ - another prove that the Silverfrost developing tools (incl. ClearWin+) is very powerful.

The examples in the FTN95 directory (incl. those where fparam.exe is required) are all very useful. However, aspects like:
1.) a graceful exit;
2.) handles; and
3.) a proper installation on a client,
to name only a few, are not addressed. When these things are not done properly then it will be the first (bad) experience by the end-user. No matter how good the "actual code" might be, it has failed the important user-test.

I would not mind to prepare a small "Getting started with Clearwin+" (from a user side) under the following conditions (I collect/test the bits and pieces provided by other users):
1.) We use the good old factoriser example;
2.) expand the menu bar to load and save user data (input);
3.) add a toolbar
4.) take care that a exit is done properly; and
5.) installation on a client using e.g. Inno Setup or NSIS

Deadline: 31.01.2011 Very Happy
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Jan 10, 2011 7:28 pm    Post subject: Reply with quote

You are welcome to do this. If you would like my comments on the finished product then please let me know.

Paul
Back to top
View user's profile Send private message AIM Address
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Mon Jan 10, 2011 10:27 pm    Post subject: Reply with quote

Jacques,

You have mentioned my software and few others as examples using ftn95 and clearwin+, so it is only fair that the list gets extended to include Lozzer's Digital Terrain Modelling software at www.dtmsoftware.com.

John
Back to top
View user's profile Send private message Visit poster's website
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Tue Jan 11, 2011 7:04 am    Post subject: Reply with quote

I was not 100% sure about DTM Software but glad that the list is growing! We also use FTN95 of course, but we do not produce a (software) product - only for the number crunching in the design our products (machines). However, I would really like to introduce ClearWin+ to my colleagues. It is crazy but true - it is "allowed" to spend hours doing something in Excel but not in Fortran!
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, 4  Next
Page 2 of 4

 
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