When you program MUI with C you do not really program C but use many many macros to define the GUI. This macros not directly convert-able to Pascal but with some functions a close functionality is possible. ChainQ did already a start with a muihelper unit for MorphOS. I moved it to ami-extra, so make it available for all Amiga platforms. To test the muihelper implementation I started to convert the MUI 3.8 example codes to Pascal. At the Amiga FPC Wiki I created a comparison of the C Source and the resulting Pascal Source. To make it a little bit more difficult I create this sources at ABIv1 AROS 64bit. Many functions still need to be adjusted for 64bit.
The image shows the biggest MUI Demo C compiled (included in the MUI user archive on the left side) and the MUI Demo Pascal compiled (fresh compiled on the Amiga).
The Sources are placed at github.
2 comments to "Programming MUI"
Looks totally amazing!
Btw, i downloaded the vmware image, but i got into problems with it.
1. Started a new project
2. added a memo and a button
2. double clicked the button, added „memo1.lines.text:=’bla bla bla‘;“
3. saves the project
4. imported your project xml build modes
5. picked Amiga 68k
When i moved the folder to my amiga and start the binary, it first could not find TForm.. so it just says „Unable to find class TForm“.
Ok, so i copied over the resource files, thinking maybe it needed them.
But now it says „Cannot find class TButton“.
I went back to VMware and noticed, that when you drop a TButton, its not added to the form-fields.. memo is, but not TButton.
Might be worth taking a look at?
Btw — love your work! Keep it up, especially 68k!!
Thanks for trying it.
I tried exact the same as you describe and it work. (As Workaround you could just add the „Button1: TButton“ line by yourself to the code) I experienced such behavior from Lazarus when then Sources has error it fails sometimes to add GUI elements to the Source.
Besides, yes you need to copy the *.fpcres file along with your m68k-amiga application. The Hunk format in Freepascal still does not support internal resources so it must keep in an extra file. (I guess I also wrote that in the readme)