Generation of Pascal code for using a Qt/Gtk object, via Lazarus' GUI builder lazarus / 39-Graphics ---------------------------------------------------------------------- vicot · 2012-12-27 23:28 A question from a total newbie: can Lazarus' native GUI creator build a Qt/Gtk graphical object? If so, will it automatically generate Pascal code that uses features from the Qt or Gtk libraries? Is this possible, or do I have to code the Qt or Gtk code manually? Thanks ---------------------------------------------------------------------- wjackson153 · 2012-12-27 23:39 Lazarus is a Frontend GUI for Free Pascal The only code it generates from General GUI syntax in the code window other then that as you add components it will embed the procedures from that component. The rest is what you add code wise to the source editor. However once you build your GUI  you could use the Project and source files from your project directory,  etc. .pas. .lpr, .lfm, .res viewing those in a text editor would reveal, component x,y cordinates, formatting , paths etc Hope this helps ---------------------------------------------------------------------- vicot · 2012-12-27 23:43 So, what would be the easiest way to produce Pascal code for a Qt/Gtk object? (possibly, not manually...) ---------------------------------------------------------------------- jmpessoa · 2012-12-28 00:27 Hi, Vicot  http://board.planetpeer.de/index.php?topic=449.0;wap2 ---------------------------------------------------------------------- wjackson153 · 2012-12-28 00:31 By learning to code in pascal ? Im not sure im understanding exactly what it is your wanting to do, but I think you mean reproduce code from your app to a memobox or file then you could do something like this Code: [Select]Memo1.Lines.Text := ' IF THEN ELSE Example' + sLineBreak + sLineBreak +    '  IF x := '' ''  THEN' + sLineBreak +    '  BEGIN' + sLineBreak +    '  label1.forecolor := ' + '''clRed '' ;' +  sLineBreak +    '  label1.caption := '+ '''The color is Red'' ;' + sLineBreak +    '  END' + sLineBreak  +    '  ELSE' + sLineBreak +    '  BEGIN' + sLineBreak +    '  label1.forecolor := ' + '''clDefault'' ;' + sLineBreak +    '  label1.caption := ' + '''No Color Defined'' ;' + sLineBreak +    '  END ;'; The output to a memobox or file would look like this:  IF THEN ELSE Example   IF x := ' '  THEN   BEGIN   label1.forecolor := 'clRed ' ;   label1.caption := 'The color is Red' ;   END   ELSE   BEGIN   label1.forecolor := 'clDefault' ;   label1.caption := 'No Color Defined' ;   END ; Is that somehow close to what your asking ? ---------------------------------------------------------------------- Blaazen · 2012-12-28 00:52 QuoteSo, what would be the easiest way to produce Pascal code for a Qt/Gtk object? (possibly, not manually...) Lazarus uses LCL (Lazarus Component Library) which is abstract framework. It means that Lazarus needs also some real widgetset to create real applications. I assume that you downloaded (or compiled) Lazarus for Qt4 or GTK2 frameworks. If you start it, Lazarus itself is GTK2 or Qt4 application. Lazarus will start with a new project. You can immediately run it (press F9) and this empty form is also already GTK2 or Qt4 application. Your question (the easiest way to produce Pascal code for a Qt/Gtk object) is therefore a little incorrect. More correct should be: What is the easiest way to create Qt/GTK2 applications using Object Pascal ? ---------------------------------------------------------------------- vicot · 2012-12-28 14:00 Quote from: Blaazen on December 28, 2012, 01:52:59 amQuoteSo, what would be the easiest way to produce Pascal code for a Qt/Gtk object? (possibly, not manually...) Your question (the easiest way to produce Pascal code for a Qt/Gtk object) is therefore a little incorrect. More correct should be: What is the easiest way to create Qt/GTK2 applications using Object Pascal ? Yes indeed. Sorry about the confusion. I have used unclear words. What I actually intend to do is to create Qt or Gtk applications. I already know that FreePascal bindings for Qt and Gtk are available for this. But my worry now is that writing the widgets manually may be too difficult for me, because I am a newbie. So, I was looking for a way to design and create the individual GUI objects/widgets (e.g. forms, text boxes) via a graphical builder. Ideally, the GUI builder would let me design the individual GUI widgets and will then automatically generates Pascal code for it (using the Qt/Gtk library, of course). Incidentally, I do need Qt or Gtk, rather than any other GUI toolkit, because as far as I know, these two toolkits are the only ones that already supports BiDi fully. I hope my question is clearer now. Thanks ---------------------------------------------------------------------- marcov · 2012-12-28 16:19 Quote from: vicot on December 28, 2012, 03:00:38 pm Incidentally, I do need Qt or Gtk, rather than any other GUI toolkit, because as far as I know, these two toolkits are the only ones that already supports BiDi fully. I hope my question is clearer now. Well, unfortunately the answer is negative then. The lazarus designer only generates forms for the LCL widgetset.  (which can be QT or GTK based though). The Lazarus designer is not a simple one way form to code generator, but two-way, adding and deleting sourcecode for events automatically, and using language resource systems for form data, and thus not easily retargeted. There are efforts in Lazarus trunk to improve the BIDI aspects of the LCL widgetset though, it might be worthwhile to get involved in that. ---------------------------------------------------------------------- jmpessoa · 2012-12-28 17:01 Lazarus for Cross-Platform Development By Mattias Gaertne Linux Journal From Issue #185 September 2009 Sep 01, 2009 http://www.linuxjournal.com/magazine/lazarus-cross-platform- development?page=0,0 ---------------------------------------------------------------------- vicot · 2012-12-28 20:57 So, there is nothing like a code sketcher for FreePascal/Lazarus, which reads an XML file generated by Glade and translates it into native Object Pascal code? ---------------------------------------------------------------------- marcov · 2012-12-28 21:50 Quote from: vicot on December 28, 2012, 09:57:38 pmSo, there is nothing like a code sketcher for FreePascal/Lazarus, which reads an XML file generated by Glade and translates it into native Object Pascal code? Such things are not within the scope of the Lazarus project, since it only uses GTK and QT as backend, and thus has no need for such things. The Free Pascal GTK2 headers do include libglade though, so maybe you can simply try to load a Glade XML runtime (or from resource), instead of codegeneration. I'm not aware of people doing direct GTK interfacing though in recent times