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 

Using Text Arrays

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Mon Oct 13, 2014 11:19 pm    Post subject: Using Text Arrays Reply with quote

I have an existing application that uses ANSI.SYS for cursor control and data input. In looking into Text Arrays, I see that this is a viable option, except for a couple of features. I've looked for an answer, but can't find anything.

I need to let the user know where the current CURSOR position is. ANSI.SYS allows the use of the blinking (flashing) underline character to indicate the current cursor position. I don't see any cursor kinds of manipulations evident for text arrays. Am I missing anything?

I could use an odd COLOR combination to indicate the current cursor position, which is probably OK, and fairly easy to do, but wondered if anyone else had solved this as their issue.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Tue Oct 14, 2014 8:00 am    Post subject: Reply with quote

You could use %tx. The debugger SDBG uses this control to display files etc. so if you run SDBG you will see what is possible.

Here is some C code that might give some hints.

Code:
  sprintf(t,"%%pv%%^hx%%^vx%%%d.%d^tx[FULL_CHAR_INPUT,FULL_MOUSE_INPUT,NO_POPUP_MENU]%%lc&",max(w-1,1),max(h-2,1));
  winio(t,&hscroll_pagesize,&hscroll_range,&hscroll_value,hscroll_bar_callback,&vscroll_pagesize,&vscroll_range,&vscroll_value,vscroll_bar_callback,data,attr_data,MAX_WINDOW_COLS,MAX_WINDOW_LINES,event_handler,&text_array_handle);


t is the format string and winio becomes winio@ in Fortran.
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Tue Oct 14, 2014 8:26 pm    Post subject: Reply with quote

Thanks, Paul.

Yes, I'm using %tx for this instantiation of an ANSI.SYS equivalent. Except for the blinking cursor, everything I need to do I have prototyped using %tx with get_wkey1@().

I just finished an experiment with font changes (size/bold/colors) and am ready to go through the interface routines to make the small tweaks needed to transition to the %tx window.

I think for the current cursor position, I'll use some visually arresting set of color attributes. The attr array makes this so very easy!
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



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

PostPosted: Tue Oct 14, 2014 9:36 pm    Post subject: Reply with quote

Some early PCs had VT52 as well as ANSI ESCape sequence driven screens, and some had them inbuilt without loadable device drivers. ANSI.SYS was particularly rubbish, and at one time there were substitutes in the form of 'terminate and stay resident' programs. It has been years since ANSI.SYS worked with current MS operating systems.

An alternative to using ESCape code driven screen control was to use interrupt driven control over the screen. A set of routines for the equivalent functions to ANSI ESCape codes was provided in FTN77, and they are documented in the FTN77 library manual (available on the Silverfrost website). They still work - in text windows (command prompt window) where the ANSI.SYS approach does not. The FTN77 library manual also documents useful routines that still function in FTN95 (although there are some that have no real meaning any more).

While you seem to be successful in using Clearwin+'s %tx in a Window (and I'm impressed beyond belief at how quickly you implemented Paul's suggestion), your user interface will not be very compatible with windows norms. In my view you'd be better off keeping with the text screen approach until you want to go to proper Windows. You would find a lot similar with what you have done, for example GET_KEY1@ instead of GET_WKEY1@, and a lot familiar with how your program worked before (e.g. the cursor appearance).

Going all the way to a full Windows application is a major exercise, and my experience from several years ago was that attempting to implement a halfway house was just putting off the dreaded day when you bite the bullet!

Your mastery of %tx suggests that it'll take you less time than it took me.

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



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Tue Oct 14, 2014 10:53 pm    Post subject: Reply with quote

Eddie, I appreciate the response.

Yes, ANSI.SYS was not all that useful, but since the software had been ported to so many totally different systems (PDP-11, PDP 10, VAX, Unisys, CP/M, MS-DOS, to name most of them), ANSI.SYS gave that reasonable compromise some real legs The users didn't have to learn a new interface; it was what they were already used to. So, I have a user base that is familiar with the look/feel of the ANSI implementation and, while they want a full Windows version, that probably won't happen in my remaining lifetime. No profit in it.

This will, certainly, be better than trying to run the old 16-bit FORTRAN software under the plethora of Windows system that have come since. There is a partial implementation of this in 16-bit Windows code (W 95), but that is not really recoverable at this point.

Small user base means not too many folks will complain (!), and if they can run it with virtual machines and the like, they'll be quite happy!

Thanks,
Bill
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1217
Location: Morrison, CO, USA

PostPosted: Sat Oct 18, 2014 10:33 pm    Post subject: Reply with quote

The ANSI.SYS replacement code is working. And, it is doing what it is supposed to do, to about the 99% point. All the internal functionality is all there; just a few more tweaks to get the human interface looking good.

The access routines point to the data item to be set from the screen inputs, kind of like callback functions. This was the most difficult task to do, using pointers, because the data is not all of one data type (character, i*2, i*4, real, logical). This required some liberal use of named common to overlay the pointer data in a generic way, then access the data according to the actual type. Only one hitch encountered with character data, easily solved.

If someone needs to do something similar, I can post the technique here for use.

I can trap all the function codes, tabs, etc. to allow the user to navigate through the data entry. Looks good and is relatively generic, and has features that are difficult in windows dialog boxes to achieve.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
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