Buchempfehlung
Visual Basic 6 Kochbuch
Visual Basic 6 Kochbuch
Viele praktische Tipps zum Programmieren mit Visual Basic 6, die sich oft auch auf FB übertragen lassen. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

Tutorial

Developing emitters for wxFBE [EN]

von RedakteurMODSeite 1 von 1

To create an emitter for wxFBE you will have to use mdTypes (download mdTypes).

The best way to start, is to checkout the source of wxFBE from svn at Externer Link!https://svn.freebasic-portal.de/svn/wxfbe
Then create a new emitter bas file in the /plugins folder. As a template you can use the example emitter wx-c-emitter.bas. The entry point for emitters is in the onDesignerCodeEmit method.

The designer generates an object filled with of all widgets in the form. The object class looks like this:

Type Designer_Form
    As mdMap(String, String) formDetails
    As mdList(mdMap(String, String)) widgetList
    As mdList(mdMap(String, String)) menuList
    As mdList(mdMap(String, String)) toolbarList
End Type

Note: In the code it will look like "mdList(mdMapStringString)". It's the same as the other representation, but FreeBASICs preprocessor can't handle defines in defines.

It makes use of mdMaps and mdLists. mdMap is a key value store which simply assignes a key to a value. Both key and value are always of String type. mdList is a linked list. The listed values are again mdMaps.

formDetails:
The formDetails map contains all information about the global information for this form. You will find these keys by default in it:

widgetList:
A list of all widgets. Every list item is a map with all information about the widget. These are the default keys:

menuList:
A list of all menu entries. These can be recursive so you will need a recursive method. Every list item is a map with all information about the menu. These are the default keys:

toolbarList:
A list of all toolbar entries. Every list item is a map with all information about the toolbar. These are the default keys:

If your toolkit is not able to emit some kind of tool, you can simply ignore that case or output a message to the user in form of a message popup window or comment in the emitted code or whatever.

Important:
The designer comes with a quick run option. While creating the form the user can use "quick run" to start the program without emitting the code. To support this feature you have to check the file name. If the file name is not empty, just emit the code to this file, but if the file name is empty, return the whole code as a string to wxFBE. It will generate a temporary file and quick run it for the user.


mdTypes will use Strings for all information, so you will have to convert some values. If the representated value is a map or list, you can use mdCollectionsHelper and its static methods createMap(String) and createList(String) to generate new maps and lists.

Moreover all handler codes will be encoded so it does not conflict with the String representation of lists and maps. They are encoded with mdCollectionsHelper.encode(String) and have to be decoded with mdCollectionsHelper.decode(String).

In the example emitter you will notice, that the handler codes are converted to mdStrings and afterwards all NEWLINEs are replaced with NEWLINEs + tabs. This will indent the handler codes so it will fit to the rest of the code.


PS:
Please fill the dynamic lib information of your plugin. I will need it in upcoming features.

 

Zusätzliche Informationen und Funktionen
  • Das Tutorial wurde am 14.04.2014 von RedakteurMOD angelegt.
  • Die aktuellste Version wurde am 17.04.2014 von RedakteurMOD gespeichert.
  Bearbeiten Bearbeiten  

  Versionen Versionen