Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a mouse with Clipper 5.3

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
GB
About twenty years too late I have realised that it would be nice to add some mouse support, however limited, to my Clipper applications.

I have investigated a couple of (free) packages.

Have downloaded Clipmous and can get the SAMPLE program to run; it is possible to click on a field to establish focus for data entry and to invoke a menu selection by clicking on a section of displayed text; this seems pretty good. However there is very limited documentation, and it is not clear to me what public variables and other modifications I need to add to my programs to make use of the supplied replacement GetSys.prg.

Have also downloaded Ferns Graphical Library (fgl v30.zip). The sample FGDEMO.EXE can be compiled and linked, but when run it appears just to change the video mode and then returns to the command prompt, so it is not possible to see what it offers (there is limited documentation).

If anyone has installed and is actively using a library which supports the use of a mouse I would be grateful to hear.

Thanks. Andrew Mozley
 
Thanks for your interest Tonhu.

The grafxsoft link which you provided certainly mentions that "CA-Clipper fully incorporates mouse support", but gives no further guidance. Likewise I can find nothing in the Norton Guide (which is installed on my system).

Have you been able to use the mouse from a Clipper application? I wanted to find someone who has experience and could let me know how they have used the mouse from their Clipper application. Maybe you are that man!
 
Hi

I used to use a little turboc program that I linked into the normal .exe

Then all I think I needed to do was initialise the mouse and modify the
inkey() function or something!

Do you want me to have a look?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Found this lot...

Code:
MCONST_INIT()
MOUSE_INIT()
MOUSE_OK = .T.
MLeft_pressed = .F.
MRight_pressed = .F.
MHorizontal = 0
MVertical = 0

FUNCTION MCONST_INIT
  PUBLIC M_RESET,M_SHOW,M_REMOVE,M_READ,M_SET_CURS
  PUBLIC M_MOTION,DONT_CARE,M_CURS_WIDTH,M_CURS_HEIGHT
  PUBLIC MOUSE_INT,M_LAST_CLICK
  M_RESET = 0
  M_SHOW = 1
  M_REMOVE = 2
  M_READ = 3
  M_SET_CURS = 4
  M_MOTION = 11
  DONT_CARE = .T.
  M_CURS_WIDTH = 8
  M_CURS_HEIGHT = 8
  MOUSE_INT = 51
  M_LAST_CLICK = SECONDS()
  RETURN(.T.)
*!*********************************************************************
*!
*!       Function: MOUSE_INIT()
*!
*!      Called by: CHANGES.PRG                   
*!
*!          Calls: CMOUSE()       (function  in ?)
*!               : RESULT2()      (function  in ?)
*!
*!*********************************************************************
FUNCTION MOUSE_INIT
  PARAMETERS NUM_BUTTONS
  PRIVATE RESULT
  PUBLIC _MESSAGES
  CMOUSE(M_RESET,1)
  CMOUSE(M_SET_CURS,0,0,0)
  CMOUSE(10,0,63487,63232)
  NUM_BUTTONS = RESULT2()
  RETURN(RESULT1() = -1)
*!*********************************************************************
*!
*!       Function: MOUSE_ON()
*!
*!      Called by: INKEYWAIT()    (function  in TBROPROC.PRG)
*!
*!          Calls: CMOUSE()       (function  in ?)
*!
*!*********************************************************************
FUNCTION MOUSE_ON
  IF MOUSE_OK
    CMOUSE(M_SHOW)
  ENDIF
  RETURN(.T.)
*!*********************************************************************
*!
*!       Function: MOUSE_OFF()
*!
*!      Called by: INKEYWAIT()    (function  in TBROPROC.PRG)
*!
*!          Calls: CMOUSE()       (function  in ?)
*!
*!*********************************************************************
FUNCTION MOUSE_OFF
  CMOUSE(M_REMOVE)
  RETURN(.T.)
*!*********************************************************************
*!
*!       Function: MOUSE_READ()
*!
*!      Called by: INKEYWAIT()    (function  in TBROPROC.PRG)
*!
*!          Calls: CMOUSE()       (function  in ?)
*!               : RESULT3()      (function  in ?)
*!               : RESULT4()      (function  in ?)
*!
*!*********************************************************************
FUNCTION MOUSE_READ
  PARAMETERS Left_pressed,Right_pressed,Horizontal,Vertical
  PRIVATE BUT_STAT
  CMOUSE(M_READ)
  Left_pressed=result2() = 1.or. result2() = 3
  Right_pressed=result2() = 2.or. result2() = 3
  Horizontal = result3() / M_CURS_WIDTH
  Vertical   = result4() / M_CURS_HEIGHT
  RETURN(.T.)
*!*********************************************************************
*!
*!       Function: MOUSE_SET_CURS()
*!
*!          Calls: CMOUSE()       (function  in ?)
*!
*!*********************************************************************
FUNCTION MOUSE_SET_CURS
  PARAMETERS NEW_H,NEW_V
  CMOUSE(M_SET_CURS,0,NEW_H,NEW_V)
  RETURN(.T.)

There is a bunch of code in the browsing routine as well...

And you need to compile this
Code:
#include "C:\LANG\SUM87\nandef.h"
#include "C:\LANG\SUM87\extend.h"
#include "include\dos.h"

int res1,res2,res3,res4;

CLIPPER result1()
{
    _retni(res1);
}

CLIPPER result2()
{
    _retni(res2);
}

CLIPPER result3()
{
    _retni(res3);
}

CLIPPER result4()
{
    _retni(res4);
}


CLIPPER cmouse()
{
    union REGS inregs;
    union REGS outregs;

    inregs.x.ax = _parni(1);
    inregs.x.bx = _parni(2);
    inregs.x.cx = _parni(3);
    inregs.x.dx = _parni(4);

    int86(0x33,&inregs,&outregs);
    res1 = outregs.x.ax;
    res2 = outregs.x.bx;
    res3 = outregs.x.cx;
    res4 = outregs.x.dx;

    _ret();

}


Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Thanks Griff. I appreciate your help.

I am not quite sure what to make of this. I can see that the first piece of coding is a Clipper program.

Do I compile that and link it it into my application? I am not sure how that will then influence the workings of the various GET statements in my application so that the respond to the mouse; do I need to make calls to MOUSE_INIT() and so on?

How do the mouse events get through to my application; I had thought that maybe the INKEY() function would be able to pick up the pressing of the mouse button, but I cannot see how to do that.

There are also calls to a function CMOUSE() in the code which you have supplied. I take it that these are calls to the separate C program in your other piece of code. I must confess that I do not have a C compiler?

I have made a little progress in getting the SAMPLE program within Clipmous to work - I can get their replacement GETSYS.PRG to work, but again I have not discovered how to catch the mouse interrupt using INKEY().

Again, if anyone has successfully used a mouse within their Clipper application it would be good to know.
 
It's a bit of a mess...

Let me get back to you

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Hello GriffMG again

I have downloaded Clipmous and its routines work fairly well. It includes low-level routines to initialise the mouse, read its status (key-press, mouse move) and the mouse co-ordinates. It provides a replacement GETSYS module so that your SAY . . GET sequences work and will position the cursor using the mouse. There is also replacement code for PROMPT . . . MENU TO

There is a replacement INKEY() function, IN_KM() which will look for a keypress or a mouse-status change. I had partly to rewrite that as INKEYM() to make the time-delay work in the same way as INKEY(n), but that was not too difficult.

If you are using Tbrowse or TbrowseNew() - I use the latter for organising my main multi-level menu - you will need to include your own code to read the mouse (or keyboard) using INKEYM(), then read the mouse co-ordinates using the M_XTEXT() and M_YTEXT() and take the appropriate action.

Detecting a double click seems to be rather a do-it-yourself activity. I found that my physical action of left-clicking the mouse was liable to be detected many times - that is, reading the status using M_STAT() did not clear the flag within Clipmous. Not sure if that is a defect of my computer, or of my understanding of Clipmous.

I am still trying to work out how to program a button (as part of a SAY . . . GET) sequence so that clicking on it (or possibly double-clicking) can invoke some action on my part. As the replacement GETSYS stands at present, a mouse click on a button is just used to set focus to that field, whereas I would like that button to get back to my program’s VALID method.

Thanks anyway for setting me on the right track. Andrew
 
Brilliant

Well done

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Hi Andrew,

fyi, check out this site also: - Home of the (o)ceans' project

It's about Clipper (alto a redesigned language and runtime that transpiles into CA-Clipper (5.2e/5.3b)) handling text mode/graphics mode from the same sources (full mouse support also), console style (no windows libraries)

At this point (the project is ongoing) the following libraries are available:

_o_1_c__ (o)ceans version of the Ca-Clipper 5.2e/5.3b standard libraries
_o_1csy_ Anton Van Straaten's Class(y) 2.4b library

_o_1_sp_ (o)ceans version of the GrumpFish Speller 1.3(a) library
_o_1_ui_ (o)ceans version of the Ca-Clipper 5.3b User Interface library
_o_1bge_ (o)ceans version of the Background Events 5.0 library
_o_1ct__ (o)ceans version of the Ca-Tools 3.0c library
_o_1fgl_ (o)ceans version of Ferns Paanakker's Ferns' Graphic Library 3.10
_o_1ft__ (o)ceans version of the Nanforum 3.05 library
_o_1lfn_ (o)ceans version of Klas Engwall's Long File Name library 1.00a/1.11
_o_1l_l_ (o)ceans version of Klas Engwall's Low Level library 1.05 /1.10
_o_1me__ (o)ceans version of the MrEdit 2.0 library
_o_1odb_ (o)ceans version of Brian Marasca's ObjectDB library 1.2j
_o_1rvg_ (o)ceans version of Rolf Van Gelder's (combined) libraries
_o_1wpc_ (o)ceans version of Potomac Document Software's WordPerfect Create library

There are demos at that webpage to download, lots of api documentation, and pre-configured VM Virtual Disks to testrun the executables

Perhaps try out Referral 0.0.3 - a little Movie/Actor Database demo, showing the basics in terms of what can be programmed already with (o)ceans' (for CA-Clipper)

Next year a Programmer's Guide is planned to be written; also note that it emphasizes the use of VM's such as DOSBox/VMware Player/VirtualBox to run these 16bit DOS programs almost anywhere

To me, Clipper programs have still a while to be around, but the project wanted to inject new ideas, hence an xBase deviating language is at its core; after transpilation it is however a plain and valid Clipper source .prg, to be linked with the usual tools, although linking is (almost) automatic; the generated .exe is still a 16bit DOS executable, but can be generated from the same sources into variants, each of them for the purpose of special runtime handling (argument checks yet or not at message entry; with or without OO support for native types; yet or not optimized for OO message calls, etc...)

All of Clipper is redesigned for OO operation, but one can still have the end executable use the procedural legacy style

Please, have a look at it, it's different, yet familiar once accustomed to

Whenever the Harbour-project introduces full support for CLASS messages - like Class(y) - the project can evolve into the new 32bit/64bit arena

Best regards,

lohen
 
Dear Lohen

Thank you for your interest.

I have had a look at Oceans, although I do not at this stage know whether this project is able to add mouse support to a Clipper application. I have visited the Oceans site, and downloaded the documentation folder. There are a great many html files there. I take it that I will need a program to read these files – are you able to make one available?

I have also downloaded and run the 56MB install program. This runs and says that it has installed Oceans on my machine. In turn this has created a 125MB folder called _o_ceans. If I navigate to it there is a folder 02121120 and within that there are three folders, an .EXE file (Choose.exe) and 13 .BAT files.

The Choose.exe does produce a Y/ N prompt, but exits whatever reply I enter.
The Demo.bat flashes up a DOS window but it disappears immediately.
The Repo.bat file does the same.

The Mes202G2.bat file brings up a DOS window which says “Starting demo: SPD131G2” and then prompts for dosbox/ntvdm and then for 00 model or 0F model. If I chose the 00 model the screen goes blank so that I can no longer use other windows applications, but it then has what I imagine is a DOS program covering the full screen with a Spellcheck application.

Is there any information available which can tell me what Oceans can do, and how the user will be able to develop an application with it. I particular I am interested to know whether it offers mouse support. A user's guide, including installation instructions would be really helpful.

Alternatively I would be happy to check out Referral 0.0.3 if you are able to let me have a copy.

Thanks. Andrew
 
Hello Andrew,

I'll try to go through your observation list :)

Docs: the html sources can be viewed with any (internet) browser (Chrome/FireFox/Internet Explorer) - (assuming you're on Windows) f.i. start explorer, double click on the menu.html (this is the starting point to the docs) - else, the _same_ html files are ready to view online (from the homepage) - in the docs download there's also a Norton Guide (Expert Guide format actually), you can use the Windows Expert Guide program by Dave Pearson (look for WEG) - once installed double-click the _O______.NG file from Windows Explorer (this same file can also be viewed from within a pure DOS environment, using EH.EXE (from former EH SofSolutions; available on the Oasis website)

Installer: As mentioned in issues.txt there might be a problem trying to run the samples from another Windows (than XP; only tested on Windows XP), so thanks for the notification (i assume you're running Windows >XP but still a 32bit version) - the .bat files such as Mes202??.bat (for the MrEdit Samples demos) and Ref003??.bat (etc...) are indeed the files to launch the demos from - the demo.bat file (for internal purpose, as well as repo.bat) decides to use choose.exe (16bit prog not able to run on Windows 64bit) or choice.exe which should come with your Windows (i was told Windows 7 re-introduced that old prog (rewritten for 64bit), but haven't verified) for allowing you to choose a model to run (00/0F); i'll add choice.exe (from Windows 7) in my next build; thx - for a quick solution: edit demo.bat and comment the line where it says

if exist "C:\Program Files (x86)" goto 0start

by putting a colon in front of it; such as

:if exist "C:\Program Files (x86)" goto 0start

But more important is that you'll have to install DOSBox when using Windows >XP - its installer is included in the c:\_o_ceans\20121120\distros folder (when installing it, use the defaults)- it is explained in the c:\_o_ceans\20121120\readme.txt file

I'm sorry for the inconvenience, but the installer doesn't want to change anything outside of its installer folder (leaving some things to be done manually)

Testrunning: Mes202??.bat (or any other launcher bat file) requires DOSBox to be installed (i'll add an error message next time) in your case (Windows 7 32bit?) - launched from Windows XP however there's a choice running the demos from DOSBox or simply natively (NTVDM layer)

Once inside the demos (run inside a DOSBox window) you can use ALT-ENTER to go fullscreen (even on Windows >XP no matter 32bit/64bit; this is a DOSBox feature)

The project is still in its infancy, only previews had been released (without make engine), mouse support is available for both 5.2e and 5.3b, text mode or graphics mode, by means of a construction similar to what 'interfaces' do for the Java language; its api is however not yet documented (the docs so far document a great deal of api's already (complying to what the project introduced as '(o)ceans notation' >< Hungarian notation; inside the documentation there's an introduction page explaining this type of 'notation methodology' in the first section; in html docs click the first item on the left page, then the right page shows (o)ceans' notation (as different from Hungarian notation) under the Quick Terminology section)

For you to have an idea what mouse support involves for the end-programmer, have a look here - every OO message from the mou():: message...() namespace does sth to support mouse detection, movement, hiding/showing, etc...

During the next year i hope to finish lots of basic informations now still lacking in the documentation (the docs so far concentrate on api's only)

Also next year, a full distribution (not merely previews) should see daylight, but keep in mind that for developing with this (experimental!) language, Windows XP is really required, not the least because of compiling with the Clipper compiler requires 16bit DOS to be supported (i have no experience with Vista/Windows 7 32bit, but it might work also)

In short, at this point the reference to the project was intended purely informative; if you seek a direct solution to update your Clipper enduser program(s) with mouse support, my best suggestion is to consult the Nanforum Toolkit library (also available on the Oasis website); for the text mode variants of the (o)ceans' demos, the mouse routines in this library has been used to support both 5.2e and 5.3b actually (although 5.3 has its own native support, but combining NF Toolkit's mouse support doesn't introduce conflict in 5.3(b))

Else, perhaps i could do you a favour with your code, if you'd consider; we can discuss this directly

Please, if you would continue test-driving the samples (with the correction suggested (inside demo.bat)), let me know whether there are yet other issues!

Thank you for your time,

Best regards,

lohen
 
As an additional note:

the 'G' in Mes202G?[.bat] and Ref003G?[.bat] indicates the graphics variant; after re-reading your message, i assume you're yet running Windows XP, but to my experience the FGL library used for the graphics, is not able to run well in NTVDM on every hardware; so, let me encourage to use DOSBox (for those on XP having the frozen fullscreen); DOSBox even works on Windows XP (and from there one can go fullscreen, no freeze problems here, provided one sometimes has to adapt the DOSBox configuration file c:\_o_ceans\20121120\repo\userconf.conf .oO but this is DOSBox territory;-) Inside that configuration file, you can select a different machine= setting, under the [dosbox] group; the possible values are listed in the .conf file; if unsure which to select, experiment a bit, it all depends on your hardware; also, the keyboardlayout= setting (under the [dos] group) is set for an azerty keyboard; please, change these to your requirements .oO I'll add these guidelines to the readme.txt file

Secondly, the 0F model executables will run slower, because they perform runtime message argument checking, reporting mismatches (if any) in a file in the ...\repo folder; models other than 00 (04 actually, but not provided here) are meant for during development testrun, helping to locate where possible errors occurred (but not severe enough to crash the app), although with the philosophy of the project in mind, features such as these, are more of an interesting side-effect, whereas on source level, f.i. for the Harbour compiler, when strong argument typing is available, this argument check feature will instead be transformed into a compiler-time only assertion; there's lots to document about the reasons behind the language construction, hopefully - as an experimental language - it pushes the limits.

Lastly, (again) as to your question about mouse integration for your existing Clipper sources, the project will not be of much help, since it requires your sources to become (o)ceans compliant, but there are stepup measures allowing for a less steep adaptation scenario; i have the BroPlus sources build for (o)ceans in such way (from the ExtraSensory website), with minimal changes to the code, and yet already available by doing so, for a graphical variant; since proprietary (copyrighted), i cannot share these however

Hth,

Best regards,

lohen
 
Hello again

Thank you for your patience. I cannot believe I am doing this right. I have tried navigating as you said (I had to use Windows Explorer) to fmenu.html in the Oceans documentation folder that I downloaded, and I first got a screen like this :

Title: (o) ?___?:Q\_o_ceans\_\___\_\______\___
Credits: (o)ceans' Q\_o_ceans\_\___\_\______\___ - all (o) 0.1.8
logolimb: (o)ceans' project [for _ca-clipper_ implied]
fyloitwg: [unrelied]
logotwig: [all namespaces]
port by: FvN (lohen@users.sf.net) the (o)ceans' project launcher


I cannot tell from this what the Oceans product is meant to be. At the very least this sort of documentation must be intended for an expert.

The WEG from Dave Pearson does better. The first screen looked like this :
Quick Terminology Reference:

(o)ceans' notation (as different from Hungarian notation)

(o)ceans' target projects
(o)ceans' server projects
(o)ceans' client projects

ontoi
logoi
fysoi
array referred ontoi
block referred ontoi
funnel referred ontoi
handle referred ontoi
array referred fysoi
block referred fysoi
funnel referred fysoi
handle referred fysoi
precision spec ontoi
array referred precision spec ontoi


I did not know what many of the terms used were (What does “handle referred fysoi” mean?) However clicking on any of the menu selections says something rather like :

explanation about (o)ceans' target projects goes here ... (TODO)

Surely it would be good to say something about what the Oceans product is, right at the start of the guide.

I am indeed running Windows XP. The Choose program does indeed run (as I described) but it is a modest application which accepts a single Y/N response and then exits. It does not really demonstrate the power of Oceans.

I have been able to run the demo.bat file from the DOS prompt. It is however just a batch file which changes the screen resolution. It mainly prompts for screen resolution, offering 640x480 – which I accept, and then exits. Selection of this resolution seems to have no effect when I run the program again.

It does not give any indication of the capabilities of the Oceans product/language, and this is what I have been trying to find out.

It would be very helpful if you could make available a description of the product, and the language, and sufficient installation instructions so that the user can know what he can do with the 120 MB of software which you have made available for downloading.

Thanks. Andrew

I have since read your note which says that DOSBOX is essential. This is an unusual requirement on an XP system which offers DOS emulation. I would be able to do this, but feel that I ought first to be given some idea of the capabilities of Oceans.

My email address is andrew dot mozley at btinternet dot com
 
Hi Andrew,

Suggested was to open menu.html (not fmenu.html) - which opens a view exactly the same as the online documentation browsing link from the project's homepage :)

As to your request for an abstract, okay, but it incorporates so many fresh ideas, i assume refering to it as an experimental language was the least (and most for now) i could share without starting long dissertations such as the (o)ceans notation article (had you found that?)

It is work in progress, but if you wish, come back from time to time; the documentation will grow along (the website is very recent)

I'm sorry you cannot find directly what this thinktank envisions to address, but there is a ChangeLog section in the docs, which already contains lots of infos; experimental are:

the programming language (the transpiler however is just enough to allow for a showcase .oO the sources to the demos)
the repository construct (detailed coverage in ChangeLog)
the notation methodology
pushing the limits of an existing language/compiler (for now, the CA-Clipper compiler)
most of all, the use of mnemonics (supporting namespacing) for self-documenting source code

of course, the language is (partly) inspired by existing languages, but yet it is different, especially thanks to the use of mnemonical techniques (this aspect has not been inspired by what (to my knowledge) exists elsewhere)

The homepage clearly mentions the emphasis is on the language, having an already functional base of code is somewhat secondary; over time, i hope to finish the Guides to ... but in the meantime, i just wanted to let people already have a glimpse of it

I'll see what i can do in the shortrun, the initiative has been going slow lately; but if you really insist on getting an idea, the (o)ceans notation dissertation (as pointed) is a good place to start

As to the invitation for installing DOSBox, it can do alot for Clipper programs in Windows beyond XP, so consider exploring it not as a waste of time; that it works evenly well in Windows XP doesn't require people to rush for later Windows versions (not all of my hardware would run Windows >XP comfortably either) just for testing it; that's great, don't you think?

And as for the 'G' batch files, they simply run what you ran with the 'T' (textmode) batches, but for graphics mode (with some additional features; nice windows, the possibility to show images, etc) - but again, these are Clipper executables which as an apprentice to the project's main value, are secondary (but verifying/affirming the useability of the (o)ceans language)

Does this description help?

Best regards,

lohen
 
Dear Lohen

Thank you for the time you have spent on this. However your Oceans project is at present incomprehensible and unusable.

At your suggestion I have downloaded 122MB from your site - your _o_ceans folder. There is no description of the the project or how to use it, no installation instructions, nothing. There are some undocumented batch files which run from the DOS prompt and mainly change the screen resolution before exiting, and, in lower directories various exe files which can be run and do spell-checking.

You have explained that there is a Help file within the folder and that you need Dave Pearson’s Expert Guide. This does indeed allow the user to open the first help screen. This is also incomprehensible, with links to “logoi”, “funnel referred ontoi”, “handle referred fysoi”. Perhaps fortunately each of these terminates in a screen such as :

Explanation about array referred precision spec ontoi goes here ... (TODO)​

So the 36MB of help files give just one screen of information, and that can only be understood by you. I take your point about installing DOSBOX onto the user’s machine but this would not resolve the problems.

I am sorry to write so directly. I feel that you have some ideas about program development, but that you should not encourage other people to use your system until you can produce :

1. A description of the system
2. Installation instructions which work.

sincerely

Andrew Mozley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top