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

Thread: New mad idea on UI module

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,782
    Rep Power
    10

    New mad idea on UI module

    This one is real vaporware: nothing developed, only free neurons.
    _________________________________________________

    It just come to my mind this morning when traveling to work a way to use the many Dialog Editors there are around the world without the necessity to write a thinBasic dedicated one but at the same time remain compatible: resource files!

    [wiki=Resource_(Windows)]Resource files[/wiki] (or usually named RC files) are text files containing the text descriptions of the many resources an application can needs: cursors, fonts, menus, icons, equates, dialogs, strings, ...

    But how is the form of a RC file?
    Imagine the Dialog showed in first picture here designed with FbEdit Dialog Editor ( http://www.radasm.com/fbedit/ )
    What is its RC representation? Just the following:
    [code=thinbasic]
    define IDD_DLG1 1000
    define IDC_GRP1 1003
    define IDC_EDT1 1001
    define IDC_STC1 1002
    define IDC_BTN1 1004
    define IDC_CHK1 1005
    define IDC_CHK2 1006
    define IDC_RBN1 1007
    define IDC_RBN2 1008
    define IDC_CBO1 1009
    define IDC_LST1 1010
    define IDC_PGB1 1011
    define IDC_TRV1 1012
    define IDC_LSV1 1013
    define IDC_TRB1 1014
    define IDC_SBR1 1015
    define IDC_DTP1 1016
    define IDC_MVI1 1017
    define IDC_RED1 1018
    define IDC_IPA1 1019
    define IDC_HDR1 1020

    IDD_DLG1 DIALOGEX 6,6,461,313
    CAPTION "IDD_DLG"
    FONT 8,"MS Sans Serif",0,0,0
    STYLE 0x10CF0000
    EXSTYLE 0x00000008
    BEGIN
    CONTROL "",IDC_EDT1,"Edit",0x50010000,14,16,104,15,0x00000200
    CONTROL "IDC_STC",IDC_STC1,"Static",0x50000000,12,38,106,17
    CONTROL "IDC_GRP",IDC_GRP1,"Button",0x50000007,10,62,108,32
    CONTROL "IDC_BTN",IDC_BTN1,"Button",0x50010000,144,16,84,39
    CONTROL "IDC_CHK",IDC_CHK1,"Button",0x50010003,148,68,56,11
    CONTROL "IDC_CHK",IDC_CHK2,"Button",0x50010003,148,88,58,13
    CONTROL "IDC_RBN",IDC_RBN1,"Button",0x50010009,128,114,70,13
    CONTROL "IDC_RBN",IDC_RBN2,"Button",0x50010009,128,134,70,15
    CONTROL "",IDC_CBO1,"ComboBox",0x50010003,224,72,72,15
    CONTROL "",IDC_LST1,"ListBox",0x50010141,222,101,72,68,0x00000200
    CONTROL "",IDC_PGB1,"msctls_progress32",0x50000000,14,158,120,11
    CONTROL "",IDC_TRV1,"SysTreeView32",0x50010007,310,12,86,44,0x00000200
    CONTROL "",IDC_LSV1,"SysListView32",0x50010003,310,68,82,50,0x00000200
    CONTROL "",IDC_TRB1,"msctls_trackbar32",0x50000000,308,129,84,11
    CONTROL "IDC_SBR",IDC_SBR1,"msctls_statusbar32",0x50000003,0,205,403,14
    CONTROL "",IDC_DTP1,"SysDateTimePick32",0x50010004,308,153,84,15
    CONTROL "",IDC_MVI1,"SysMonthCal32",0x50000000,14,180,140,67,0x00000200
    CONTROL "IDC_RED",IDC_RED1,"RichEdit20A",0x50010000,174,179,114,56,0x00000200
    CONTROL "",IDC_IPA1,"SysIPAddress32",0x50010000,14,107,90,17
    CONTROL "",IDC_HDR1,"SysHeader32",0x50000002,318,197,126,17
    END
    [/code]
    Few equates used to define Controls IDs. An area where the DIALOG start its description. A BEGIN/END area in which all the controls placed over the dialog are described in details with exactly the same information you would specify in your script.

    So, to create a new dialog with all controls why not using one of the many Dialog Editors to write a resource file and inside thinBasic script write something like the following:

    [code=thinbasic]
    #RESOURCE ".\MyResources.rc"
    '---The following is just a prototype of a possible syntax
    DIALOG LOAD IDD_DLG1 To hWnd
    '---
    [/code]
    The above script with just one line would load all dialog information searching inside loaded resources and will create a new dialog using the dialog ID IDD_DLG1. Consider the little fact that also all controls present into the RC files will be created automatically for you inside the dialog.

    _________________________________________________

    I'm still elaborating this possibility because I do not know if RC files are written the same way by the many Dialog editors present. I just wanted to share the idea to see if more expert people on RC files have something to say or other users here have something to tell about it. The more I think about it the more it seems doable to me. I need a new parser specifically implemented for RC resources. But this is not a big problem.

    Let me know.
    Ciao
    Eros

    Attached Images Attached Images
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2

    Re: New mad idea on UI module

    The format that you have there from FreeBasic isn't a standard resource file (.rc) format, which is generally oriented towards C/C++. Here's what a resource file looks like that's generated by Visual C++, which is the de facto standard:

    [code=c]
    // Microsoft Visual C++ generated resource script.
    //
    #include "resource.h"

    #define APSTUDIO_READONLY_SYMBOLS
    /////////////////////////////////////////////////////////////////////////////
    //
    // Generated from the TEXTINCLUDE 2 resource.
    //
    #include "afxres.h"

    /////////////////////////////////////////////////////////////////////////////
    #undef APSTUDIO_READONLY_SYMBOLS

    /////////////////////////////////////////////////////////////////////////////
    // English (U.S.) resources

    #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
    #ifdef _WIN32
    LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
    #pragma code_page(1252)
    #endif //_WIN32

    #ifdef APSTUDIO_INVOKED
    /////////////////////////////////////////////////////////////////////////////
    //
    // TEXTINCLUDE
    //

    1 TEXTINCLUDE
    BEGIN
    "resource.h\0"
    END

    2 TEXTINCLUDE
    BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
    END

    3 TEXTINCLUDE
    BEGIN
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "#ifdef _WIN32\r\n"
    "LANGUAGE 9, 1\r\n"
    "#pragma code_page(1252)\r\n"
    "#endif //_WIN32\r\n"
    "#include ""afxres.rc"" // Standard components\r\n"
    "#endif\r\n"
    "\0"
    END

    #endif // APSTUDIO_INVOKED


    /////////////////////////////////////////////////////////////////////////////
    //
    // Version
    //

    VS_VERSION_INFO VERSIONINFO
    FILEVERSION 1,0,0,0
    PRODUCTVERSION 1,0,0,0
    FILEFLAGSMASK 0x0L
    #ifdef _DEBUG
    FILEFLAGS 0x1L
    #else
    FILEFLAGS 0x0L
    #endif
    FILEOS 0x4L
    FILETYPE 0x1L
    FILESUBTYPE 0x0L
    BEGIN
    BLOCK "StringFileInfo"
    BEGIN
    BLOCK "040904e4"
    BEGIN
    VALUE "Comments", "This is a comment"
    VALUE "CompanyName", "Company Name"
    VALUE "FileDescription", "File Description"
    VALUE "FileVersion", "1.0.0.0"
    VALUE "InternalName", "FILENAME"
    VALUE "LegalCopyright", "Copyright 2008 Some Company. All rights reserved."
    VALUE "OriginalFilename", "FILENAME.EXE"
    VALUE "ProductName", "Product Name"
    VALUE "ProductVersion", "1.0.0.0"
    END
    END
    BLOCK "VarFileInfo"
    BEGIN
    VALUE "Translation", 0x409, 1252
    END
    END


    /////////////////////////////////////////////////////////////////////////////
    //
    // Dialog
    //

    IDD_MAINDIALOG DIALOGEX 0, 0, 295, 170
    STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION
    CAPTION "Main Dialog"
    FONT 8, "Tahoma", 400, 0, 0x0
    BEGIN
    ICON 32516,IDC_STATIC,14,15,20,20
    LTEXT "Text message",IDC_STATIC,41,15,239,18
    LTEXT "Label1:",IDC_STATIC,100,61,164,10
    EDITTEXT IDC_EDIT1,100,86,158,13,ES_AUTOHSCROLL
    LTEXT "Label2:",IDC_STATIC,41,104,53,10
    EDITTEXT IDC_EDIT2,100,102,158,13,ES_AUTOHSCROLL
    LTEXT "Label3:",IDC_STATIC,41,120,47,10
    EDITTEXT IDC_EDIT3,100,119,158,13,ES_AUTOHSCROLL
    DEFPUSHBUTTON "OK",IDOK,94,149,48,14
    PUSHBUTTON "Cancel",IDCANCEL,153,149,48,14
    END

    /////////////////////////////////////////////////////////////////////////////
    //
    // Menu
    //

    IDR_MENU1 MENU
    BEGIN
    POPUP "&File"
    BEGIN
    MENUITEM "E&xit\tAlt-F4", ID_FILE_EXIT
    END
    POPUP "&Help"
    BEGIN
    MENUITEM "&Contents\tF1", ID_HELP_CONTENTS
    MENUITEM SEPARATOR
    MENUITEM "&About", ID_HELP_ABOUT
    END
    END

    /////////////////////////////////////////////////////////////////////////////
    //
    // Icon
    //

    // Icon with lowest ID value placed first to ensure application icon
    // remains consistent on all systems.
    IDI_ICON1 ICON "res\\icon1.ico"

    /////////////////////////////////////////////////////////////////////////////
    //
    // String Table
    //

    STRINGTABLE
    BEGIN
    IDS_VALUE1 "This is string value number one."
    IDS_VALUE2 "This is string value number two."
    IDS_VALUE3 "This is string value number three."
    END

    #endif // English (U.S.) resources
    /////////////////////////////////////////////////////////////////////////////



    #ifndef APSTUDIO_INVOKED
    /////////////////////////////////////////////////////////////////////////////
    //
    // Generated from the TEXTINCLUDE 3 resource.
    //
    #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
    #ifdef _WIN32
    LANGUAGE 9, 1
    #pragma code_page(1252)
    #endif //_WIN32
    #include "afxres.rc" // Standard components
    #endif

    /////////////////////////////////////////////////////////////////////////////
    #endif // not APSTUDIO_INVOKED
    [/code]

    In short, your parser would need to understand C-style comments and macros. The definition of the constants (e.g.: IDD_MAINDIALOG) would be defined in a separate .h header file, not in the resource file itself, so you'd also need to be able to load and parse that as well.


  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,782
    Rep Power
    10

    Re: New mad idea on UI module

    Thanks a lot Mike.

    So far I'm just interested in the DIALOG and MENU areas of a RC file so many resources described there can be avoided and just ignored during first implementation.
    Many of the equates can be pre-defined in the parser.

    Anyhow, after the next thinBasic release I will start to study RC possibility.

    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: New mad idea on UI module

    Idea is very nice,

    I thought about it too, but not in form of RC parsing, but in form of RC to UI code generator.
    Your method is better, at least for the programmer I think, as it means less work.

    Then there is that RC editor coming with PB too, which was the reason for my idea ... but that RC editor is not very luxury one, as it is 16bit proggie from Microsoft


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #5

    Re: New mad idea on UI module

    Have you guys reached out to any of the third-party folks like Chris Boss (EZGUI) or Paul Squires (Firefly) about contributing a UI designer for thinBasic? The fact that syntatically it's similar to PowerBASIC would seem to make it a good fit. Perhaps they could do something like contribute a basic version to be included with thinBasic, and offer a more advanced commercial version. Just a thought, there.

  6. #6

    Re: New mad idea on UI module

    Ketil O's is the best I've used.

    http://www.radasm.com/resed/index.html

    Edit: I forgot to mention there is a dll version implemented as a control so it's easy to just add it to a Dialog just like any other control. His Edit control is quite good too. I was going to put a PB IDE together using these but got side tracked with.......

    James

  7. #7
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: New mad idea on UI module

    Mike,

    that is interesting idea

    Jcfuller, thanks a lot for good program link, it seems very comfortable so far.
    I think I can leave the realm of MS DlgEdit.exe and enter new world


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  8. #8
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,782
    Rep Power
    10

    Re: New mad idea on UI module

    Quote Originally Posted by Mike Stefanik
    Have you guys reached out to any of the third-party folks like Chris Boss (EZGUI) or Paul Squires (Firefly) about contributing a UI designer for thinBasic? The fact that syntatically it's similar to PowerBASIC would seem to make it a good fit. Perhaps they could do something like contribute a basic version to be included with thinBasic, and offer a more advanced commercial version. Just a thought, there.
    Mike,

    on UI side, I think we have still to improve a bit. And next thinBasic version will make a great jump into the right direction.
    So far to be able to manage a Window message loop we had to create a WHILE/WEND loop just after a DIALOG SHOW MODELESS ...
    Also getting a windows message was in reality simulated by an internal thinbasic function that cumulates events in a per window array of events. Even if this has done the job for most of the basic cases, it reached a nightmare handling.

    Next thinBasic version will have real message handling driven by new callbacks script functions. Callbacks will be available for mainly all controls (except for those controls driven by notifications to parent window) and all windows. Callback syntax will be almost the same as in PB. Maybe this will be the starting for a possible interest from other programmers to jump here and see where we are and maybe if they can find their ways with thinBasic.

    The one you mentioned are professional programmers that mainly look at sales for their jobs. So I'm not sure they will be interested in a free project. In any case I can see some space for possibly commercial applications (both as utilities or commercial modules) but we need to have a wider user base. I prefer to move with little steps.

    Thanks a lot for your ideas and contributions.
    Eros

    _________________________________________________
    PS: for those reading this post about commercial possibilities, be sure: thinBasic programming language will always remain free.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  9. #9

    Re: New mad idea on UI module

    Hi Eros, that is a great idea. Back in 2004 and my IBasic Pro times I was working on a dialog editor. Would be interesting to revieve this project.
    Attached Images Attached Images

  10. #10
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: New mad idea on UI module

    Hi Mike,

    your project looked very nice, reminds me of Delphi dialog designer.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Page 1 of 2 12 LastLast

Similar Threads

  1. LOG: new module idea
    By ErosOlmi in forum Suggest new module
    Replies: 3
    Last Post: 13-11-2007, 02:28

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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