I knew I had not done anything on the File Manager for some time but that the last post was almost a year ago even surprised me. That is probably also the last time I did any programming on it. I even had to read back to see what I was up to at that moment. I decided to continue on Aros using Zune which is an object-oriented GUI toolkit. It is nearly a clone (at both API and Look&Feel level) of MUI, a well-known Amiga shareware product by Stefan Stuntz. I am going to switch back to OS4.1 using ReAction. At the time I was still programming using ReAction the wrong way. Since I am doing it the correct way with my Redhouse Editor project I decided to ditch all the current code and use the Redhouse Editor code for which I program ReAction the correct way. So what I have at the moment is a window that is being opened and already has a small menu system in place.
The above Window is what I have at the moment. Simple but proper ReAction code so a good start if you ask me. What I plant to do next is to play around a bit with the layout. Getting myself a bit familiar with the Layout Class to make it look like a bit more like a File Manager. When you talk about a File Manager look you instantly think about the two column look like you can see below from Directory Opus.
For this I will have to use the List Browser Class. I remember how difficult it was last time I tried to have a go at it. I better be prepared this time and get the job done.
One of my plans for this year was to start programming something on OS4.1 and actually finish it with the purpose if documenting every step so people could learn something from it. I tried it with the Redhouse File Manager but at the moment I am not as excited about it as I was before so I want to start with something new and exciting. I will continue with the Redhouse File Manager at some stage but for now I decided on something new. I decided to start programming, at first, a simple editor.
Above you can see the start of my Amiga Editor project. Just a simple window with the title “Amiga Editor”. I started a series of articles called “ReAction – Opening a Window” before and with three published already and one pending I decided to take them off-line and use them for this project. I will write about every step I take and provide the code and explain it as well. This will really benefit the people that want to program on OS4.x.
The above picture shows the lines of code that will setup the window that you see in the beginning of this post. It’s not difficult to understand and even without any background info on ReAction/Intuition you somehow can make some sense out of this. The biggest hurdle will be to understand ReAction/Intuition in order to get your stuff working. Over time you will understand more parts of it and things will suddenly make sense but it can be very frustrating at times. It is not uncommon to use code in your program that you don’t fully understand but it gets the job done. But overtime you start to understand it, major ego boost, which is one of the best feelings you can have as a programmer. Next time I will discuss some snippets of code.
It was going to be a series of 4 articles explaining how to open a ReAction window in C on OS4.x. I had 3 released already with the fourth on pending. Instead of writing the fourth article I decided to take the three articles off-line and use them in my new Amiga Editor project.
Since Aros uses Zune which is a MUI clone I had to get myself familiar with MUI. I know a bit about ReAction which is being used by OS4.x which does come in handy when using MUI. Since I knew nothing about MUI I probably will use up most of the coming time on getting myself familiar with it.
As you might know I prefer opening my own libraries instead of having it done by the compiler. I know it is extra work but it will teach you more about libraries. You can use libraries without even having to open and close them or even worry about the error handling (check if you manage to open them or not and what to do). I learned a lot from doing it myself and that kind of knowledge can be useful for other coding parts as well. When it comes to MUI we have to open the MUI library. Below are the code fragments we need to get this done. First the includes, setting up the pointer and finally opening the library.
struct MUIMasterBase *MUIMasterBase;
MUIMasterBase = (struct MUIMasterBase *)OpenLibrary(“muimaster.library”, 39);
But when I compile it I get the error “Conflicting types for MUI MasterBase”. I am not sure but to me it seems to be the <proto/muimaster.h> include that is the culprit. I posted about this on the Aros-Exec forums in the hope of getting this resolved soon. I am taking a short break from it so maybe the solution might come to me.
I left my Redhouse file manager project on hold for some time already. Started out on OS4.x I thought it was a good time to continue with it on Aros for now. I am getting myself familiar with Aros so what better way better than to involve Aros in to it. One thing I really miss, and “highlighted” already several times is a editor that supports C syntax highlights. Being used to CodeBench and Cubic IDE it is a big must for me. I really hope someone will create this. For now I am using the NoWinED editor. When the code is not that large yet it is fine but once it grows you just loose that great ability of oversight.
Programming on Aros is somewhat different compared to OS4.x. The approach to libraries and the GUI toolkit of choice are different. When it comes to libraries we will switch back to the old classic way of opening them. I actually like this since it is true to the classic way of doing things and since I invested a lot of time in Amiga OS libraries the classic way and new OS4.x way it is not really a problem to switch back to this way of opening libraries.
Instead of ReAction which is used on OS4.x we are using Zune on Aros. Zune is an object-oriented GUI toolkit. It is nearly a clone (at both API and Look&Feel level) of MUI, a well-known Amiga shareware product by Stefan Stuntz. I have no experience with MUI so for me this will be a bit of a hurdle. I always got the idea that there are more and better MUI classes one can use giving you a more easier way of getting your code done. So far I already have small example of a window that is being displayed with some control code that will close it again. That will be the basis from which I will continue. First I will start with a split window look which is the basis for each Amiga file manager if you ask me.
The decision has been made; I am going to purchase OS4.1 for my A1SE! The main reason for this is that when I am programming some stuff does not work the way it should be and what works in one example does not in the other. I am getting some real strange results which I am contributing to the OS4 Pre-Release I am using. For example with some ReAction stuff I had to use code that is not really recommended any more to get it to work. When I follow the guideline for ReAction it just does not work and gives me the Grim Reaper. Since I was going to start with ReAction for The Bucket Programming Corner I really did not want to teach you all the incorrect ways of programming. Plus there are so many other benefits when it comes to Amiga OS4.1 and the updates. The plan is to purchase it within the next two weeks or so.
I really have to DeC myself at the moment since I started to program in Amos again. I need start thinking basic again instead of C. Work on the disk magazine is going rather slow at the moment. On top of that I also want to do a few tutorials on Amos. It is really strange but as soon as you start Amos you start getting these happy feelings from the past. Just seeing some code on the screen makes me smile. Amos still has this great nostalgic wow factor which says something about Amos. This week it is a short column but I felt like sharing my OS4.1 purchase urge. Till next time!
Finally I managed to fix the crashing issue when another issue surfaced.
After solving this one I ran into another one that seems to be even worse. My window displays but when I click to close it nothing happens.
After spending a lot of time on it and not getting really any further I decided to move back to my previous “older” code. I was following Trixie’s article over at OS4Coding.net regarding the proper way of programming with ReAction. One of part of the proper way of using ReAction was:
Instead of using OpenLibrary() to open ReAction Classes we should use OpenClass() to open the ReAction Classes. Besides returning the class library base (which we store in WindowBase) it will also return something called the class pointer.
Instead of using the OpenClass() function I am now (again) using OpenLibrary() and GetInterface() to open ReAction Classes. You might remember that in a previous article I was talking about how can you check if the class pointer is also being opened when you use the OpenClass() function.
My question about this is that when we check if we opened the Window class do we also need to check if we got the pointer and if so how? Or can we assume that if we succeed in opening the Window class we also have successfully got the class pointer?
Maybe it did not really open (class pointer) which is the reason my code for closing the window is not working. Besides this part there is another part for which I switched back to my “older” code. Don’t use RA_OpenWindow() to open a window but instead use WM_OPEN which would look something like this:
window = (struct Window *)IIntuition->IDoMethod(objects[OID_WINDOW], WM_OPEN, NULL);
I moved back to using RA_OpenWindow() which would look something like this:
window = RA_OpenWindow (winobj);
Just ignore all the parts of the code it is just for reference. The third and last part I moved away from is WM_HANDLEINPUT. This is part of the code that will loop (keeping our window open till we do something like clicking something) and would look like something like this:
while ( (result = IIntuition->IDoMethod(winObj, WM_HANDLEINPUT, &code)) != WMHI_LASTMSG )
I moved back to using the RA_HandleInput() macro which would look something like this:
while ( (result = RA_HandleInput(winObj, &code)))
As a result my code works now and clicking on the close button actually closes my window. I could not keep spending time on this issue so I had to move back in order for my code to work and move on. At a later stage I might do some further testing so that eventually I can move back. If you go through the ReAction examples for OS4 you do get rather confused since every example seems to differ from the other. But since I now got it to work I am moving on to the next part which is the layout. At first I want to start with having buttons on top of the window. See example screenshot below which is from the utility Filer from Bjorn Hagstrom.
I will discuss the layout and buttons in the next article. Till next time!