Dr Wimp p7

Upgrading

Every so often, an upgraded Dr Wimp package appears. In each one, an Upgrading file (in the Documents folder) gives detailed instructions on how to update your existing Dr Wimp applications.

It is usually very simple to do - and sometimes involves nothing more than substituting the new version of the Dr Wimp library. More likely though, there is a need to change a few items in your existing !RunImage files as well, but nothing complicated.

But do you need to upgrade every time a new Dr Wimp version appears? Well, only you can answer that and here are a few relevant points.

If your existing application is working very nicely thank you and you have no immediate need to alter it, then there is no need to do anything (other than to ensure that you keep a copy of the !MyApp skeleton that you used to create the application!).

However, if you are starting a new application or intending to add facilities to an existing application, then it is worthwhile using the latest version of the Dr Wimp package.

To upgrade an existing application, start with a copy of your 'source' !RunImage (i.e. non-linked, non-compressed) and follow the upgrading instructions carefully and in the given sequence. They are simple but must be followed exactly. Typical instructions might, for instance, include adding a new user-function, or adding a new parameter to all occurrences of a particular wimp-function.

Once these steps are taken and with the new Dr Wimp library in place (and with enough wimpslot to allow the 'raw' coding to be accommodated) check that your application still does what it did before - and that's all there is to it. You now have an upgraded baseline for further development of the application using the latest Dr Wimp version.

If you find that you need to upgrade an application which used a Dr Wimp version earlier than just 'the one before', you simply need to follow each set of appropriate upgrading instructions in turn. (It may not always be absolutely essential to do this but it is the safest way by far.)

By the way, if you think upgrading is a chore, spare a thought for me. Each new release means that I have to upgrade each of the more than 20 example applications in the Examples folder. With this quantity to be done - always in a bit of a hurry - it can be an error-prone exercise, as I have recently experienced!

Using !Linker

!Linker is one of the post-programming utilities included in the Dr Wimp package. Its use is entirely optional.

What it does is scan both your !RunImage and the Dr Wimp library and produce a single composite !RunImage which contains your original !RunImage plus (automatically copied from the Dr Wimp library) only those wimp-function definitions actually needed for your particular application. The separate Dr Wimp library is then no longer needed for that application.

But don't forget that you may want to upgrade/debug your application at some future time. So always keep a copy of your original !RunImage and the full Dr Wimp library which was used to create it. If/when you want to modify the application, modify (a copy of!) the original !RunImage and use !Linker again afterwards.

One thing you need to be careful of (up to v.3.54 of the Dr Wimp package, at least) is that !Linker can't be relied upon to work properly unless all DEF PROC/FNs are separated by a line with just a colon in it e.g.

DEF FNsomething
=returnvalue%
:
DEF PROCsomethingelse
ENDPROC

That colon is very important. It is already religiously used in the Dr Wimp library and it needs to be present in your !RunImage.

It is vital because !Linker currently uses these colons when scanning the !RunImage/Dr Wimp library, to detect the end of a DEF PROC/FN (which isn't as simple a task as might be thought). In the near future, I hope to get rid of this restriction and to improve the documentation in this area.

So, if you have been experiencing any 'funnies' when using !Linker, it is worth having a look at the colons - or the absence of them!

By the way, some other freeware/shareware utilities can also link a library with a !RunImage, usually as part-and-parcel with a Basic compaction exercise. However, as far as I know, !Linker is the only one which sticks solely to linking - so the result is just as readable and editable as the originals from which it came. Personally, I find this point an advantage.

Finally, just in case you are worried, the names of the !RunImage and library files are immaterial to !Linker. You can use it to 'link' any Basic program with any library that it is using.

Left-handed menus?

Did you know that you can make your menus 'left-handed' simply by putting a back-slash ("\") as the first character of the menu title when defining a menu?

This is a RISCOS feature, so it applies whether you use Dr Wimp or not. But, of course, it is so much easier to implement with Dr Wimp: just use "\Title/First/Second/..... (etc.)" for your menu string in FNwimp_createmenu - or the equivalent if using FNwimp_createmenuarray.

The back-slash doesn't appear in the resulting menu title but you will find that ticks appear on the right and arrowheads on the left; submenus open on the left; left-justified menus become right-justified (and vice versa).


Source: Archive 13.07
Publication: Archive Magazine
Contributor: Ray Favre