Difference between revisions of "MSEide+MSEgui"
Revision as of 17:43, 16 November 2006
- 1 Introduction
- 2 Installation
- 3 Quick start
- 4 Tips
The MSE IDE is a Cross Platform GUI Development System completely written in Pascal for Pascal programmers. Despite being a single person (Martin Schreiber) effort for the moment, the IDE has already an amazing feature list. More info and downloads are available on the home page MSEide+MSEgui
But what about Lazarus ?
Lazarus is an IDE that aims to provide a high degree of compatibility with VCL code while providing a native look on many platforms. The native look is very important for many developers, but combined with the VCL compatibility necessitates many comlex interfaces to the different native widget sets (Gtk,Win32,Carbon,Qt). The continuous evolution of these native widget sets (gtk1->gtk2, win32->?, qt) provokes endless catching up. The MSE GUI does not feature (or does not suffer :-) VCL compatibility. The graphics library provides an interface to win32 and X11. The advantage of the X11 layer is the immediate availability of a large and stable (in time) target platform. The different goals of both projects make that both projects fulfill different needs.
Why this wiki
The design of the MSE GUI is a fresh approach to GUI design patterns. It features many innovative solutions for typical GUI tasks. Being innovative, the MSE GUI library differs substantially from VCL/LCL/CLX. Switching from VCL to MSE may be more challenging than switching from VCL to LCL. These wiki pages aim to ease the first steps with this promising IDE and GUI library.
See home page.
Launch the IDE and use Project->Open to open the provide demo msegui/apps/demo/demo.prj. The title of the IDE reflects the opened project. Hit F9 and (if you followed the installation instructions :-), be amazed by the speed of FPC+MSE.
First RAD steps
Close the running project. Use Project->Source to open the project source demo.pas. Ctrl-click on the parameter mainfo in the line
to navigate to main.pas. Click on F12 to toggle between unit and form. Not everything will feel that familiar, because of that, these pages are written. Click on the button, this will auto raise the property editor (unusual but usefull). Let us add another button. Make the component palette visible if necessary (View->Toolbar->Component Palette). Select the tbutton on the widget page. Click on the form to create the button. Give it a caption in the usual way. Creating an event handler does not work with the usual double clicking on the onexecute property. Instead, you must select the onexecute property in the property editor, type the name of an event handler and press enter. The MSE RAD will create the handler and position the pointer on the definition. Use ctrl-shift-down arrow (or up) to navigate between implementation and definition. Just add some code like writeln('Hello world'); Hit F9. The writeln will end up in the target console window of MSE (not the console in which you started MSE).
Adding a Main Menu
Add Main Menu
Add a tmainmenu component from the Widget Component tab to your main form. Click on your mainform (mainfo) so that the Object Inspector show the properties of the mainform. Use the arrow next to the mainmenu property of the mainform, to select tmainmenu1 as the mainmenu of mainfo.
Add Menu Items
In the object inspector click on the cross to open the mainmenu treeview branch. Open the menu property of mainmenu. Change the submenu.count of menu to 1 (or higher). Now open the submenu.count property, it will show "Item 0". Open "Item 0" and set the caption to "File". Change the submenu.count property of "Item 0" to 1. Open this last submenu.count property and set the caption of the new "Item 0" to Quit. Hit F9 and your program should have a menu File with the entry Quit in it.
Once there is one submenu, you can add more by right clicking on a "Item X". This will reveal a context sensitive menu with "Insert, Append, Delete".
Once you have more than one submenu, you can use drag and drop to move the "Item X"s. Start the drag mouse move on the "Item X" line.
Some may find the standard menu font a bit small. The standard font for the main menu of an msegui application is the font defined by the stf_menu stock font. You can change a stock font value with a startup parameter.
So if you start the mseide like this, you can get a larger font:
- Use submenu.count to add the first submenu entry.
- Right click on a menu item "Item X" to display a context-sensitive menu that allows to insert,append or delete a submenu entry
- Use drag and drop on a submenu entry to move the different submenu entries.
Main way in MSEide is set the tab order after all widgets are placed in the form with the popup menu function "Set Tab Order". Select a widget in the container where you wish to set the tab oder, click right, click "Set Tab Order", click row 0, click "Start", click the widget in the container which should get tab order 0, click the widget which should get tab order 1..
- Put ttabwidget control on the form. Now you have container (ttabwidget1) for pages.
- Put as many ttabpage controls on the ttabwidget1 as tabs you want.
We have two widgets (widgetLeft, widgetRight) and we need horizontal splitter between them.
- Add TSplitter to form and resize it as you want.
- Change the linkleft of tsplitter1 to widgetLeft and linkright to widgetRight. At this step our widgets stick to splitter.
- Change the spo_hmove to True. That's all.
- If you want to save a proportion between width of widgetLeft and width of widgetRight when the main form is resized then change the so_hprop to True.
- If you need the vertical splitter then use other properties linktop, linkbottom, spo_vmove, spo_vprop.
Switch-off auto-scrolling of the form(widget)
Change the container - frame - sbhorz - options - sbo_showauto property of the form to False.
Read/write data in the twidgetgrid
Inserted editwidget.value -> value of the actual row, editwidget[rowindex] or editwidget.gridvalue[rowindex]-> value of the addressed row, editwidget.gridvalues the whole column as a dynamic array.
Read the beginner's tutorial (in Russian) at: http://freepascal.ru/article//mse/20060108181639/
Also: "MSEide+MSEgui. Draw lesson." (in Russian) http://freepascal.ru/article//mse/20060205191314/
You can also find an English translation here: http://www.geocities.com/yetanothergeek/mseide-tutorial-en/
This page in Russian: http://freepascal.ru/wiki/index.php/MSEide%26MSEgui