• Welcome to PlanetSquires Forums.
 

Update

Started by Paul Squires, March 21, 2018, 10:01:04 AM

Previous topic - Next topic

Paul Squires

This weekend I *finally* tackled code that I had been procrastinating on for many weeks.... the PropertyList. The PropertyList needs to display several internal tools in order to get the property choice from the user. For example, a textbox to get text data, a combobox to get True/False choices or other lists, a Color picker, Font picker, Picture picker.... etc.  I have all of the internal code finished that creates, assigns, and processes properties for forms and controls. I have the edit control and combobox pickers done. Next will be the color picker. Once the PropertyList is finally finished I plan to write the Menu Editor. That one should be easier.

Screenshot of the PropertyList is attached.

Hang in there guys... visual designer will be done as soon as I can.


Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

....man, I'd forgotten how much work building a visual designer actually is!  :D
Still working on the PropertyList.
It's looking good.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

A couple of screenshots of the greatly enhanced ToolBox. The PropertyList is fully functional (except for Image/Icon selection).
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Happy to present a couple more screenshots. This one shows the Label control displaying custom foreground and background colors; a standard system styled button control; and a non-themed styled button with custom colors and different font. The second screenshot shows the code generated that produces this form and controls. WinFBE only generates code for those properties where the property value is different than the default values (in order to prevent too much code bloat in the output).
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

#19
This syntax will make VB guys very happy.

For coloured buttons and ownerdraw labels, I have a crazy idea to make them yet more colourful: to optionally use gradients. You will need entry fields for two TRIVERTEX structures with fields for Red, Green, Blue and Alpha and, when drawing the background color, instead of FillRect to call GrandietFill.

You will also need a field for the type of gradient: vertical or horizontal.

Paul Squires

Hi Jose, I am modelling the code structure off of .net from Visual Studio 2017. I am looking at the C# syntax but this does also look very VB-like. Not sure about the gradients - that style seems very 5 years ago. I don't see many applications these days that make use of gradient themed buttons controls anymore.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

raymw

Not sure if any help, but can't you use an image for all button colouring, gradients, tartans, tessellations and other patterns? Not sure how it works, never used button images, and I guess it would need more memory, but an image for normal, another for pressed for every button (and then you could create a nice graphics program to generate said images...).

José Roca

Quote from: Paul Squires on July 04, 2018, 07:46:14 AM
Hi Jose, I am modelling the code structure off of .net from Visual Studio 2017. I am looking at the C# syntax but this does also look very VB-like. Not sure about the gradients - that style seems very 5 years ago. I don't see many applications these days that make use of gradient themed buttons controls anymore.

I personally don't like them. Maybe in a label, but for buttons I use a icon at most. Some think that an abundance of colors makes a gui more appealing, but I find them tacky.

Paul Squires

Tacky. Exactly.
Windows seems to be moving towards a more clean, uncluttered, flat style.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

My plan is to upload a test version of the editor package by Thursday, July 12 so you guys can see the direction that the visual designer is headed in and provide some feedback. I will include a small sample program showing the available buttons and some code that responds to events, etc. So far the controls available are Button, CheckBox, ListBox, Label and TextBox.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Johan Klassen

#25
hello Paul Squires
will the visual designer work like VB?
my guess is probably not, but unless you are proficient in Windows SDK programming or are willing to spend 2 years in learning, it will not help people like me.
recently I had promised a friend to write a small GUI app and I wrote in VB6, had only briefly been exposed to VB about 20 years ago, it took me 2 weeks to learn and make the app, and that was spending maybe one hour a day (about 12 hours total)
I had a crazy thought, what if there was a cheat-sheet giving in two or four lines of code the different actions for basic controls, for example
how to get the text from a TextBox
how to set the text in a TextBox
how to select all the text in a TextBox when in focus, that is, the text is automatically selected when visited via Tab key
how to intercept the Shift and or Return keys
how to send a key to TextBox, for example, send Tab key when the return or enter key is pressed, also send shift-tab when shift-return or shift-enter is pressed.

Paul Squires

Hi Johan, that is EXACTLY the type of help reference that I will write for this project. Basically a series of How to Do Things with each control rather than an endless list of properties, methods and events. The visual designer is working like VB - actually, like a hybrid of VB and Visual Studio C# and .Net. The idea is to abstract away as much of the Windows SDK programming as possible because the last 10 years has shown me that most users tend not to take the time to learn the nuts and bolts of WinAPI programming but rather higher level wrappers. At this point, not many of those methods/wrappers are written yet because I am concentrating on getting the actual controls basics to work first. Wrappers/methods are the easy part to write. For example, below I wrote the SelectNextControl method in about a minute and added it to the base control class.

Here is how it would work for your TextBox example (assume the TextBox is called txtAddress and is located on a form called frmMain):
(CWSTR is a dynamic unicode string class type from Jose's WinFBX library). The new visual designer is 100% unicode only.

- how to get the text from a TextBox
Dim As CWSTR wszAddress = frmMain.txtAddress.Text

- how to set the text in a TextBox
frmMain.txtAddress.Text = "This is my new address"

- how to select all the text in a TextBox when in focus, that is, the text is automatically selected when visited via Tab key
This is how the visual designer already works in the resulting produced compiled exe. As the textbox gains focus the text is highlighted. Likewise, when the code below is executed to simulate TAB, SHIFT+TAB, it also highlights the textbox text (if the textbox.MultiLine property is False).

- how to intercept the Shift and or Return keys
- how to send a key to TextBox, for example, send Tab key when the return or enter key is pressed, also send shift-tab when shift-return or shift-enter is pressed.
The following code works perfectly in the current code of the visual designer. I am still deciding how to handle trapping keyboard input. The code below cataches it in KeyUp but you can also catch it in KeyDown or KeyPress (which is WM_CHAR). I am thinking of routing all keys ultimately through KeyPress (ascii and virtual) so you have one method where you can reliably know you'll find all keypresses (I will see how .Net handles this kind of thing).


''
''
Function frmMain_txtAddress_KeyUp( ByRef sender As wfxTextBox, ByRef e As EventArgs) As LRESULT
   
   ' Catch the RETURN key to simulate TAB and Shift-TAB
   ' If you were wanting to test multiple textboxes controls (eg. a series of textboxes) then
   ' I would the following code in a dedicated function rather than duplicating it each time.
   if e.KeyCode = VK_RETURN then
      if e.Shift then
         sender.SelectNextControl(false)
      else
         sender.SelectNextControl(true)
      end if
      e.Handled = true   
   END IF
   
   Function = 0
End Function

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

#27
Looks like I am already handling keyboard input very similarly to the way that .Net handles it:

Key events occur in the following order:
    KeyDown
    KeyPress
    KeyUp

The KeyPress event is not raised by non-character keys other than space and backspace; however, the non-character keys do raise the KeyDown and KeyUp events.

Therefore to catch the ENTER key, need to use KeyDown or KeyUp. I chose to do it in KeyUp.
This is very similar to how the WinAPI handles keyboard input through messages like WM_KEYDOWN, WM_KEYUP, and WM_CHAR.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Johan Klassen

wow, I am excited :)
this is exactly what I was hoping for.

Paul Squires

Thanks Johan, still a long way to go but the future looks promising.
:)
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer