You may also be interested in the developer's documentation.
Table of Contents
MrEd Designer is relatively easy to use. Its purpose is to provide a GUI to create GUIs for Racket (ex PLT Scheme).
Refer to PLaneT instructions for installation.
First, select the "project" in the Hierarchy Panel. Then click on the "frame" button in the Main Panel. Select the frame, either by clicking inside it, or by clicking on its name in the Hierarchy Panel. Then add some widgets from the Main Panel.
In the "Generate code..." section of the Main Panel, click on "To console". Copy the generated code into a Scheme file, execute it, and call the defined init-function.
You should now see the frame that you have created.
If you have difficulties using MrEd Designer, or for any other comment, you can contact me (laurent orseau gmail com).
To start, you can create a project (File/New Project), in which you can add frames, in which you can add buttons, check-boxes, panels, other frames and other containers, etc. Just click on the corresponding buttons.
Once you're happy with it, you can generate the Racket code -- a module -- either directly in the console or saved in a file. Once you `require' this module and call the project specific init function, the same frames that you defined should appear.
Several projects can be opened at the same time (useful for copy/paste between different projects).
In the hierarchy panel, you can rearrange the widgets. Move them up or down, or cut/copy/paste them from one node to the other.
When you click on an widget in the frame, its properties are displayed in the property panel. You can modify them to suit your needs.
IMPORTANT: Don't forget to click "Update Preview" to see the changes (in most cases, you can also press Enter).
In general, it is a good idea to change the 'id' of each widget to give it an informative one.
For general information about the fields, please refer to Racket GUI documentation.
On the left of each field, there is a check-box. Check it if you want the corresponding field identifier to be an optional argument of the initialization function in the generated code. For example, suppose you have a button named `my-button' and the callback is checked. Generate the .rkt file of your project. Then call the init function with something like:
(my-project-init #:my-button-callback (lambda (b e) (displayln "Button pressed!")))
Then press the button...
As a special case, when an id check-box is checked, the corresponding identifier is `provide'd by the generated module. By default, callbacks are checked, as well as ids for frames and dialogs, so that they can be given at call time.
If you check this (left-)check-box, the class of this widget in the generated code will be a keyword optional argument of the init function. This is useful for example if you want a frame that augments `on-close'. Check this box, then when calling the generated initialization function, do something like:
(my-project-init #:my-frame-code-gen-class (class my-frame% (super-new) (define/augment (on-close) (displayln "Closing..."))))
For frames and dialogs, the `show-at-init' property defines whether the frame/dialog is shown when the generated function is called. By default, it is true for frames, and false for dialogs.
When a project is selected, you can see a "code-requires" property. This list is the module names that will be added to the 'require' form in the project's generated code. You can add other requirement, or even suppress the default ones if your are sure you don't need them (e.g., "framework" is needed when using tab-panels).
A project also has a "runtime-paths?" property.
Check this box if you want all paths in the generated code to be defined with
These properties have a check-box and a text-field where a number can be entered. The number value is taken into account only if the box is checked, otherwise the value is #f (which is useful to let the frames/dialogs be placed automatically).
A label property is usually a text-field, but can also have a check-box and a button to choose an image, e.g., for button%s and message%s. The image is taken into account only if the box is checked, otherwise the label uses the text-field value.
File paths (like images) are always relative to the .med project file, even if it is not in a direct sub-directory.
Images are loaded with the 'unknown/mask flag for transparency.
To use runtime-paths in the generated code, check the runtime-paths? box in the project properties.
Templates a useful widgets or compound widgets that you may reuse from time to time. Suppose you have made a form as a group-box with several buttons, check-boxes and text-fields, and you think you may use it at several places. Just click on the group-box, click "Save" in the template group and enter a descriptive name. Now your new template should appear in the template list.
If you want to paste a template somewhere else, say in another frame, just select that frame or node, select the template in the list and click insert.
Templates are also useful to give different default values to widgets.
If you think you have made a useful template, please don't hesitate to send it to me, I may integrate it in the next release.
If you need a specific widget that cannot be made with templates, then you may need a plugin. This needs a little programming.
In the "widgets" folder of MrEd Designer, you can see all the default widgets, which are in fact treated as plugins.
To add a plugin, create a new folder, e.g. "my-widget". In it, create a "widget.rkt" file and an "icon" folder with two images: "16x16.png" and "24x24.png" (images for the widget plugin button in the Toolbox and for the icon in the Hierarchy Panel). Or just copy an existing plugin, like "check-box".
In "widget.rkt" the one form that must be called is
The first set or arguments describe the plugin. The second set are the default widget properties (property fields).
The last set of arguments are fields that are applied to the `new' call with the widget class, and so depends on the widget class.
The right part of a field can be either a simple value (#t, 123, "Hello", '("a" "b" "c"), etc.) or a property%. Simple values will in fact be turned automatically into property%s.
Simples values will be displayed in the Property Panel with the following:
If by chance you happen to make a new plugin, please send it to me, I'm interested!
Last edited by Metaxal,