Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: thinBasic Visual Designer Code Generator

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,187
    Blog Entries
    2
    Rep Power
    10

    thinBasic Visual Designer Code Generator

    Ok, some vaporware to show in thinBasic world.
    It is some time I'm working on next thinBasic version 1.9.
    I've already added many new features to the language, many new options to SDK engine regarding Module Classes, and now I've started to work to a very rough visual designer.
    I've used a quite old piece of code from PB forum public released by "JULES MARCHILDON" (I will add merit in executable when it will released) changing and adapting it to work under all latest Windows Versions including Windows 8.

    So far I've added few controls, control property dialog, form properties, tab order dialog, possibility to save forms in binary format in order to be able to save and re-open when needed.
    At the end, the visual designer directly produces thinBasic source code ready to be pasted into a thinBasic script and be executed.
    I've intention to release Visual Designer as PowerBasic source code so everyone will be able to participate in development.
    The idea is to finish beta version able to work as simple thinBasic code generator but later I will try to add events to forms and controls in order to add thinBasic source code directly into designer and produce real applications and not just skeleton of scrips.

    Anyway, a video is worth 1000 words.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,187
    Blog Entries
    2
    Rep Power
    10
    That is not automatic.
    What is best is usually a programmer by programmer decision and is valid only for that programmer.
    So, the most there will be on the table the better for thinBasic programmers.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,796
    Blog Entries
    3
    Rep Power
    693
    Eros,

    this looks really great, it would be big help in form intensive applications. The controls are intuitive, I like it very much!
    My mind is already full of wild ideas:

    Visual designer itself
    • add support for RESIZE of controls (anchors)
    • use Begin ControlID/End ControlID blocks in generated code for equates
    • add option to generate code for dialog, which is not in TBMain (code for secondary dialog, for example to be placed to other thinBASIC Unit)
    • add help label to the form, where you pick the styles - beginners are usually not familiar with Win32 styles
      • something to think about - preserve style definition using Win32 styles, or go the route of "general" styles implemented via Win32 behind the curtains?

    • define the format of forms in XML -> possible use by modules, see below


    Module related to visual designer - classic conservative approach

    • ability to save/load the forms from XML(or other format) to script.
      So something like hDlg = Module_CreateForm( sPathToFile )
      The benefit is that the code does get simpler, without 100 lines of dialog definition
    • the equates could be then defined from module via thinBASIC_AddEquate without need to be explicitly named in code


    Module related to visual designer - OOP style
    As ThinBASIC modules in 1.9.0.0 will have great power, I think it would be possible to design standalone module, allowing to handle forms via OOPish syntax. Imagine:
    DIM myForm AS TBForm = new TBForm("Form1.bin") ' -- Constructor loads the form definition from file
    myForm.ShowModal( EventProcedure ) ' -- Classic method call, passes callback function name as parameter, invokable internally using thinBasic_FunctionSimpleCall_ByPtr
    
    ...
    
    myForm.Edit1.Text = "Hello" ' -- Now this is a bit more complex, but not that much - each control has its equate stored in the definition file, so via the approach which is used for method chains in Betas, when I find symbol, which is not method, I look if it is not name of the control (based on loaded data), and then behave accordingly
    

    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,187
    Blog Entries
    2
    Rep Power
    10
    eh eh Petr,

    I know your mind is always travelling fast and in different directions at the same time. And ... I LIKE IT

    At the moment all is very rough:
    • Visual Designer Power Basic code is quite copy/paste mode from different sources. I need to better organize, "modularize" and beautify it before I can release it
    • form can be saved but actually only in binary format. I will sure convert it into XML format
    • thinBasic generated code is quite bad but the beauty is that it can be "modulated" in the sense we can add different "code generators" dynamically.
      In any way next generated code will be much better
    • I still need to add all main controls. After that I will add thinBasic special controls
    • I definitely want to add possibility to add events (in form and controls) and add thinBasic source code to events directly into Visual Designer
    • I will also add possibility to execute thinBasic code directly from Visual Editor without the need to copy/past code into thinAir. Anyway all possibilities will be available.

    So, a lot to work on but seems exciting looking at the possibilities.

    Very soon I will release PowerBasic Visual Designer source code into thinBasic SVN server

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  5. #5
    Eros,

    The preview looked good. I came to the forum today to read some older threads about making Dialogs and Forms. So it was nice to see what you have planned for thinBasic's future.

    Lance

  6. #6
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    61
    Posts
    3,869
    Rep Power
    397
    Looks really nice Eros! Such a good language needed a good form designer and your plans for the future sound really great!

  7. #7

    thinFORM and netbooks

    Hello:

    This is my first post. I am a retired tech writer who enjoys programming games and things for my grandson and I have just discovered thinBASIC (GREAT!!). I have been playing around with thinFORM and have discovered that thinFORM draws its control to a fixed height that exceeds the size of the NetBook screen.Looking at the code it looke like 668 pixels and the netbook is only 576 pixels high.

    I can look at the thinFORM code and it looks like an easy fix is to have all of the buttons at the bottom of the control appear on another floating control. (as in older versions of GIMP with multiple g=floating controls and palettes).

    Would that be a reasonable approach to fixing the problem?

    Thanks

    Terry Ward
    taward@elp.rr.com

  8. #8
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,187
    Blog Entries
    2
    Rep Power
    10
    Hello Terry and welcome to thinBasic community forum.

    The new Visual Designer we are talking in this thread is something that still has to be released.
    This thread is just a preview (we are under vaporware forum ) of what I'm working on and was shown in order to let thinBasic user know about it and get some feedback/suggestions/impressions.

    thinForm, instead, was a user project developed directly in thinBasic and is available as source code. You can change it in order to adapt to your needs.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  9. #9
    i never tried the visual designer (in the Tools menu) before, but now i have tried it and it is realy something good and makes the life easier.
    there is only one note, i choose font size for the textbox and the button to be "Arial Black", 12 but albeit reflected on the form during the design it does not reflected in the code, the code generated by the vd is:

    '------------------------------------------------------------------------------
    '------------------------------------------------------------------------------
    'thinAir Visual Designer
    '------------------------------------------------------------------------------
    ' Project: Visual Designer generated code
    ' File:    Your file name
    ' Created: On 06-25-2017 at 15:08:47
    '------------------------------------------------------------------------------
    
    '---Needed thinBasic modules
    Uses "UI"
    
    '---Controls IDs---
    Begin ControlID
    	%IDC_BUTTON_1
    	%IDC_EDIT_1
    End ControlID
    
    
    
    '------------------------------------------------------------------------------
    ' Main thinBasic function
    '------------------------------------------------------------------------------
    Function TBMain() As Long
    
    	MainWindow_Create(%HWND_DESKTOP)
    
    End Function
    
    '------------------------------------------------------------------------------
    ' Create main Window
    '------------------------------------------------------------------------------
    Function MainWindow_Create(ByVal hParent As Long) As Long
    
    	Local hDlg     As Long
    	Local hFont    As Long
    	Local lStyle   As Long
    	Local lStyleEx As Long
    	lStyle = _                          
    	        %WS_DLGFRAME          | _   
    	        %WS_CAPTION           | _   
    	        %WS_SYSMENU           | _   
    	        %WS_OVERLAPPEDWINDOW  | _   
    	        %WS_CLIPCHILDREN      | _   
    	        %WS_CLIPSIBLINGS      | _   
    	        %DS_CENTER                  
    	lStyleEx = 0                        
    
    	Dialog New Pixels, hParent, "Form1", -1, -1, 476, 230, lStyle, lStyleEx, To hDlg
    
    	hFont = Font_Create("MS Sans Serif", 8)
    	Dialog Send hDlg, %WM_SETFONT, hFont, 0
    
    
    
    	Control Add Button, hDlg, %IDC_BUTTON_1, "Run", 16, 24, 88, 72, %WS_CHILD Or %WS_CLIPSIBLINGS Or %WS_TABSTOP Or %WS_VISIBLE Or %BS_PUSHBUTTON, 0
    	Control Add Textbox, hDlg, %IDC_EDIT_1, "Edit1", 184, 32, 256, 184, %WS_CHILD Or %WS_CLIPSIBLINGS Or %WS_TABSTOP Or %WS_VISIBLE Or %WS_VSCROLL Or %ES_AUTOVSCROLL Or %ES_MULTILINE Or %ES_WANTRETURN, %WS_EX_CLIENTEDGE Or %WS_EX_LEFT
    
    	Dialog Show Modal hDlg, Call MainWindow_Proc
    
    	Win_DeleteObject hFont
    
    End Function
    
    '------------------------------------------------------------------------------
    ' Main WIndow CallBack handler
    '------------------------------------------------------------------------------
    CallBack Function MainWindow_Proc() As Long
    
    	Local pNMHDR   As NMHDR Ptr
    
    	Local PageNo   As Long     
    
    	Local hFontTab As Long     
    
    	Select Case (CBMSG)
    
    	    Case %WM_INITDIALOG
    	    Case %WM_COMMAND
    	        Select Case LOWRD(CBWPARAM)
    	            Case %IDOK
    	            Case %IDCANCEL
    	        End Select
    
    	    Case %WM_NOTIFY
    	    Case %WM_DESTROY
    	End Select
    End Function
    
    in any case this is trivial issue relative to benifits of this vd

    so i have added
    hFont = Font_Create("Arial Black", 12)
    Dialog Send hDlg, %WM_SETFONT, hFont, 0

    and
    Control Send hDlg, %IDC_BUTTON_1, %WM_SETFONT, hFont, 0
    Control Send hDlg, %IDC_EDIT_1, %WM_SETFONT, hFont, 0
    '------------------------------------------------------------------------------
    'thinAir Visual Designer
    '------------------------------------------------------------------------------
    ' Project: Visual Designer generated code
    ' File:    Your file name
    ' Created: On 06-25-2017 at 14:45:20
    '------------------------------------------------------------------------------
    
    '---Needed thinBasic modules
    Uses "UI"
    
    '---Controls IDs---
    Begin ControlID
    	%IDC_BUTTON_1
    	%IDC_EDIT_1
    End ControlID
    
    
    
    '------------------------------------------------------------------------------
    ' Main thinBasic function
    '------------------------------------------------------------------------------
    Function TBMain() As Long
    
    	MainWindow_Create(%HWND_DESKTOP)
    
    End Function
    
    '------------------------------------------------------------------------------
    ' Create main Window
    '------------------------------------------------------------------------------
    Function MainWindow_Create(ByVal hParent As Long) As Long
    
    	Global hDlg     As Long
    	Local hFont    As Long
    	Local lStyle   As Long
    	Local lStyleEx As Long
    	lStyle = _                          
    	        %WS_DLGFRAME          | _   
    	        %WS_CAPTION           | _   
    	        %WS_SYSMENU           | _   
    	        %WS_OVERLAPPEDWINDOW  | _   
    	        %WS_CLIPCHILDREN      | _   
    	        %WS_CLIPSIBLINGS      | _   
    	        %DS_CENTER                  
    	lStyleEx = 0                        
    
    	Dialog New Pixels, hParent, "Form1", -1, -1, 476, 230, lStyle, lStyleEx, To hDlg
    
    	'hFont = Font_Create("MS Sans Serif", 8)
    	hFont = Font_Create("Arial Black", 12)
    	Dialog Send hDlg, %WM_SETFONT, hFont, 0
    
    
    
    	Control Add Button, hDlg, %IDC_BUTTON_1, "Run", 16, 24, 88, 72, %WS_CHILD Or %WS_CLIPSIBLINGS Or %WS_TABSTOP Or %WS_VISIBLE Or %BS_PUSHBUTTON, 0
    	Control Add Textbox, hDlg, %IDC_EDIT_1, "Edit1", 184, 32, 256, 184, %WS_CHILD Or %WS_CLIPSIBLINGS Or %WS_TABSTOP Or %WS_VISIBLE Or %WS_VSCROLL Or %ES_AUTOVSCROLL Or %ES_MULTILINE Or %ES_WANTRETURN, %WS_EX_CLIENTEDGE Or %WS_EX_LEFT
      Control Send hDlg, %IDC_BUTTON_1, %WM_SETFONT, hFont, 0 
      Control Send hDlg, %IDC_EDIT_1, %WM_SETFONT, hFont, 0
    
    	Dialog Show Modal hDlg, Call MainWindow_Proc
    
    	Win_DeleteObject hFont
    
    End Function
    
    '------------------------------------------------------------------------------
    ' Main WIndow CallBack handler
    '------------------------------------------------------------------------------
    CallBack Function MainWindow_Proc() As Long
    
    	Local pNMHDR   As NMHDR Ptr
    
    	Local PageNo   As Long     
    
    	Local hFontTab As Long
       
    
    	Select Case (CBMSG)
    	    Case %WM_INITDIALOG
    	    Case %WM_COMMAND
    	        Select Case CBCTL
    	            Case %IDC_BUTTON_1
                  Control Append Text hDlg, %IDC_EDIT_1, $CRLF & "big font size "
              End Select
    	        Select Case LOWRD(CBWPARAM)
    	            Case %IDOK
    	            Case %IDCANCEL
    	        End Select
    
    	    Case %WM_NOTIFY
    	    Case %WM_DESTROY
    	End Select
    End Function
    
    in any case this is trivial issue relative to benifits of this vd
    Last edited by primo; 25-06-2017 at 15:41.

  10. #10
    I think VD needs some improvements also. Assume that you create a simple gui today and get the code. You, then added some more functionalities to that gui and thus made an application with that code and bundled it and sent to friend. Next day he calls you and told that he needs some extra features in that app. Some trivial changes. You agreed and changed the work you have done in VD. VD then creates the code again but how would you include in your app ? You need to manually search for changes in new code( which VD creates now) copy the newly created lines only to your existing code. Is this a problem. So i think VD can read existing thinbasic code and it shouldn't change the existing code you have added.

Page 1 of 2 12 LastLast

Similar Threads

  1. Is there a thinBASIC Script UI Designer
    By gian20 in forum thinBasic General
    Replies: 2
    Last Post: 09-04-2012, 04:06
  2. thinBasic interface under Microsoft visual C/C++ language
    By RobertoBianchi in forum MSVC++ 6.0
    Replies: 26
    Last Post: 05-03-2010, 17:10
  3. Firefly Visual designer
    By Michael Clease in forum Development
    Replies: 0
    Last Post: 30-07-2009, 10:28
  4. Does ThinBasic have a visual-dragDrop-IDE?
    By VernonMarsden in forum thinAir General
    Replies: 3
    Last Post: 30-06-2009, 07:24
  5. Replies: 8
    Last Post: 05-08-2008, 19:12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •