Ideas for improvement

You need some new stunning features ? Tell us here.
Axolotl
Enthusiast
Enthusiast
Posts: 435
Joined: Wed Dec 31, 2008 3:36 pm

Ideas for improvement

Post by Axolotl »

Hi there,
when creating interfaces for windows desktop apps with the help of FD, I always have to make changes to the code. Which is notoriously difficult, because the designer overwrites the changed code. (For this I have a solution called copy&paste).
Now I have the following small ideas, which may be easy to add without breaking the concept.

1: Add a freely editable 'Flag' Field to the properties section of the windows and gadgets
The results as they appear in the code view in the form of examples
(a) OpenWindow(..)
-> OpenWindow(1, 10, 10, 80, 80, "Title", #PB_Window_Borderless|#PB_Window_Invisible|#WS_CHILD|#WS_CLIPCHILDREN)
.. Content in the 'Flag' Field: #WS_CHILD|#WS_CLIPCHILDREN
(b) Gadgets(..)
-> ListViewGadget(1, 10, 10, 200, 200, #LBS_NOSEL)
.. Content in the 'Flag' Field: #LBS_NOSEL
-> StringGadget(2, 9, 52, 339, 20, "", #ES_MULTILINE|#ES_AUTOVSCROLL)
.. Content in the 'Flag' Field: #ES_MULTILINE|#ES_AUTOVSCROLL

The entries do not have to be checked, but simply inserted.


2: Could it be possible to process the gadget positioning a little bit more flexible
Use of variables like FormWidth and FormHeight for something like this:
-> TextGadget(#PB_ANY, FormWidth/2-80, 10, 80, "Only an Example.")


3: Naming of Variables and Caption
In addition to the name of the variable, the caption should also be assigned a default text. The name of the variable could be used.
Variable : Button_0
Caption : <>

My Expectation (underscore is not the point)
Variable : Button1 ;' or Button_1
Caption : Button1 ;' Button_1


4: Duplicate Gadgets by Ctrl+C Ctrl+V
When creating duplicates using Ctrl+C and Ctrl+V, the new elements are named like this.
Variable : Button_0
Variable : Button_0_Copy1
Variable : Button_0_Copy1_Copy2

A "nicer" notation might be:
Variable : Button1
Variable : Button2
Variable : Button3


I could probably do this myself, because the IDE is open source (OSS). Unfortunately, my skills are not sufficient for this.
Furthermore, I would be interested to know if there is a need for such improvements at all, or if everyone has and uses their own approach.

Happy coding and Stay healthy.
Mostly running PureBasic <latest stable version and current alpha/beta> (x64) on Windows 11 Home
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Ideas for improvement

Post by TI-994A »

Some good suggestions. However, it should be noted that the Form Designer is meant for creating forms, with sized, positioned, and attributed gadgets. Just as with event processing, all changes, modifications, and other processes should be handled by external code files that call these form files. As for naming conventions, the gadget identifiers are fully customisable within the form properties. But to set captions as variables and then assign them values as well would simply be counter-intuitive.

Just some thoughts.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Ideas for improvement

Post by Caronte3D »

Axolotl wrote:...when creating interfaces for windows desktop apps with the help of FD, I always have to make changes to the code. Which is notoriously difficult, because the designer overwrites the changed code.
Yes! The Form Designer is horrible specially if your program have complex forms that needs changes :cry:
I hope some day this thing becomes better or at least someone does it externally
Axolotl
Enthusiast
Enthusiast
Posts: 435
Joined: Wed Dec 31, 2008 3:36 pm

Re: Ideas for improvement

Post by Axolotl »

@TI-994A:

thanks for your feedback and yes, I know and I agree.

I had the cautious hope that with the opening of the IDE in the direction of OSS a greater activity would arise.
There are some great guys already active and I would like to support more. Unfortunately, wanting is not enough, you also have to be able to do it.

Anyways, I am not a professional software developer.
As I mentioned earlier, I focus on coding Desktop Apps on Windows and just for fun, not to make a living from it.
IMHO you need a (very) good graphical form editor if you want to use PB to create real windows desktop apps.
I understand that PB is an open-platform tool for many different things, and I can't see which way it's going to go.
That's okay with me, because thats the intention from the beginning I guess.
So I work with what's there.

While seeing these different aproaches on visual-, form- or xml- designers I thought that it could be a good idea to ask about improvements on the standard which is shipped with PB.
Mostly running PureBasic <latest stable version and current alpha/beta> (x64) on Windows 11 Home
Axolotl
Enthusiast
Enthusiast
Posts: 435
Joined: Wed Dec 31, 2008 3:36 pm

Re: Ideas for improvement

Post by Axolotl »

@Caronte3D

thanks for your feedback
I don't think that the right (my) approach is to wait and see.
Unfortunately, my needs are only a fraction of what you can do with PB. (However, this is also the case with DELPHI and Visual Studio).
I also believe that probably not many people write professional windows desktop apps with PB.

In addition, there are currently many new / modern approaches that go away from win32.

I will have a look into the source code of the IDE and tools and see if i understand some of it...
Mostly running PureBasic <latest stable version and current alpha/beta> (x64) on Windows 11 Home
User avatar
HwyStar
Enthusiast
Enthusiast
Posts: 101
Joined: Mon Apr 05, 2010 7:13 pm
Location: Reno, Nevada

Re: Ideas for improvement

Post by HwyStar »

I would like to add my thoughts to this post. Maybe this concept will help define another way of doing it?

In Clarion Software we have a built-in form designer that allows us to place our cursor "inside" a block of window code, and by pressing Ctrl+D we are taken into the form designer. It is so simple to use and so fast! The form designer is built into the IDE and writes the code directly into the same file that has the events in it too.

Clarion code, handles the enumeration of the objects by using "?USE" variables that the compiler assigns at compile-time and the programmer can reference by using the "?" character. We don't need to ever use enumeration which is super nice.

Here is some sample code that I put together in about five minutes. I can change the code, using the form designer and it updates the "window structure" for me. I place my cursor anywhere inside of the "WIN" --> "END", press Ctrl+D, and it displays the window for GUI editing.

If PB had this, and a Report GUI formatting tool too (Clarion has this too), I would be in heaven here in PB land. PB is a such a great and powerful language!

If you would like me to provide some screen prints of the GUI, to help foster ideas, I would be happy to provide them. I am not sure if that would violate any copyrights of Clarion software and will think that through some more.

Code: Select all

  PROGRAM
  MAP
  END

!/////////////////////////////////////////////////////////////////////////////
WIN WINDOW('Caption'),AT(,,557,344),GRAY,FONT('MS Sans Serif',8,,FONT:regular)
    LIST,AT(5,9,546,306),USE(?LIST1),FROM(LIST1:Queue)
    BUTTON('&OK'),AT(11,321,35,14),USE(?OkButton),DEFAULT
    BUTTON('&Cancel'),AT(51,321,36,14),USE(?CancelButton),LEFT
  END
!/////////////////////////////////////////////////////////////////////////////
  CODE
  OPEN(WIN) 
  WIN{PROP:XPOS} = GETINI('TEST','XPOS',1,'TEST.INI')
  WIN{PROP:YPOS} = GETINI('TEST','YPOS',1,'TEST.INI')
  ACCEPT
     CASE FIELD()
     OF 0
        CASE EVENT()
        OF EVENT:OpenWindow
        END
     OF ?OkButton
        CASE EVENT()
        OF EVENT:Accepted
        END
     OF ?CancelButton
        CASE EVENT()
        OF EVENT:Accepted
           POST(EVENT:CloseWindow)
        END
     END
  END
  PUTINI('TEST','XPOS',WIN{PROP:XPOS},'TEST.INI')
  PUTINI('TEST','YPOS',WIN{PROP:YPOS},'TEST.INI')
  CLOSE(WIN)
  
"WIN" always equals FIELD() "0".
johnfowler
New User
New User
Posts: 1
Joined: Wed Feb 09, 2022 12:44 am

Re: Ideas for improvement

Post by johnfowler »

1. I use the form designer multiple times in a project and always must change the ID for each Statusbar, Menu and Toolbar if used. I change these to the Window Id contained in the Enumeration FormWindow so that 2 or more windows may be opened simultaneously. I also provide an Enumeration FormWindow and FormGadget in my project to eliminate window and gadget numbers of 0 so that 0 can be used for testing (If statements) and would like to see a baseoption 1 as in VB or Enumeration bases being able to be set in the designer.

2. One of the Explorer gadgets sets the NoFile flag to true if others flags are set and this must be corrected before saving each time.

3. The MDI gadget is a favorite of mine and must be programmed externally to the form. It would be nice if an empty MDI gadget could be added in the designer.

4. The splittergadget does not render well in my Form Designer and I would like to see it rendered being able to parent two containers on the designer so multiple gadgets could be added to each side of the splitter.

5. The declaration of procedures is copied from my pbf file to an Events file and the Declare statement changed to Procedure with the following lines then pasted

:TODO
:Macro

ProcedureReturn #True
EndProcedure

This permits quick coding of the Events File and eliminates the errors of not programming the procedures and builds the project management and macro facilities into the procedure. The macro must be programmed and setup with a ComplierIf statement. For a large form the TODO statement is then followed by the procedure name which is pasted in to indicate what must be written.
My project starts with a file called NEST.pb which includes the IncludeFiles statements for the Events and Form files and the repeat until loop including the calls to the Form events procedure.
I would like to see a menu item attached to the form menu to create an Events file as described above or similar or a tool from the tools menu

Please note:- I am a long time user of Windows XP and Windows 7 and I hate Windows 8 and above. The only reason I don't use Linux is because of the difficulty in loading all the requirements for Purebasic in Ubuntu - I don't know how to get the compiler to work. The Form Designer however saves an enormous amount of work on both systems and makes sharing code on different systems a breeze.

Thanks - John
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: Ideas for improvement

Post by Marc56us »

johnfowler wrote: Wed Feb 09, 2022 1:54 am 1. I use the form designer multiple times in a project and always must change the ID for each Statusbar, Menu and Toolbar if used.
...
Yes, this point is a big miss when using FD for multiple windows. :|
But why do the status bar, the toolbar, the button bar use a numeric identifier (alway 0) while the other gadgets have a constant? :| Bug, oversight or technical impossibility? :?:
Sample of simple form with FD

Code: Select all

Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
  OpenWindow(#Window_0, x, y, width, height, "", #PB_Window_SystemMenu)
  CreateToolBar(0, WindowID(#Window_0))
  ToolBarImageButton(#Toolbar_0,ImageID())
  CreateStatusBar(0, WindowID(#Window_0))
  AddStatusBarField(50)
  StatusBarText(0, 0, "Label")
  CreateMenu(0, WindowID(#Window_0))
  MenuTitle("MenuTitle")
  ButtonGadget(#Button_0, 10, ToolBarHeight(0) + 10, 100, 25, "")
EndProcedure
Post Reply