WinFBE Suite 1.7.5 (August 22, 2018)

Started by Paul Squires, August 22, 2018, 04:52:19 PM

Previous topic - Next topic

Paul Squires

Version 1.7.5 (August 22, 2018)
- Added: OptionButton toolbox control.
- Added: Frame toolbox control.
- Added: Implemented logic for controls "Locked" property.
- Added: Implemented logic for top menu option "Lock Controls" (this is a global override locking the form and all controls on the form).
- Added: Pasting controls automatically increments the TabIndex property for the newly created controls.
- Added: Entering an existing TabIndex number will automatically re-number all higher TabIndex value controls. 
- Changed: Greatly refactored the underlying WinFormsX code dealing with the message pump and keyboard input handling and modal/modeless forms.
- Fixed: Pasting controls was not immediately setting the form dirty thereby not saving the changes.
- Fixed: Dropdown combobox in ToolBox that displays list of controls for the form was not updating when controls deleted from the form.
- Fixed: AutoInsert inserting "End Function" and/or "End Sub" in situations when it should not. Fix from 1.7.4 failed on "FUNCTION =" lines.
- Fixed: Keyboard focus is now correctly restored when a popup modal form is closed.

https://github.com/PaulSquires/WinFBE/releases
Paul Squires
PlanetSquires Software

raymw

Hi Paul,
Why is it that for the frame, background refers to the text, whereas for a label, background fills the whole label? I'm also wondering what the differances are between labels and buttons, since the appearance of each and events are more or less the same. Come to think of it, why not just have forms?

raymw

Experimenting with the idea of labels instead of buttons, if you mousedown and mouseup a few times on a label, (at button clicking speed) then the program shuts down.

Paul Squires

Quote from: raymw on August 23, 2018, 07:11:16 PM
Hi Paul,
Why is it that for the frame, background refers to the text, whereas for a label, background fills the whole label? I'm also wondering what the differances are between labels and buttons, since the appearance of each and events are more or less the same. Come to think of it, why not just have forms?
That's the way Windows API works. A "Frame" in WinFBE is simply a button with BS_GROUPBOX style. In other IDE's like Visual Studio, Visual Basic, etc... a Frame control is implemented as a custom control and acts like a container where you can place other controls inside of it and move them and act on them like a self contained group. In WinAPI, a BS_GROUPBOX styled button always only changes the background color of the text of the frame (not the frame background). Likewise, you can not change the forecolor of the text unless the Windows Themes are disabled. You can not change the forecolor of CheckBoxes or OptionButtons either. See, Windows can be a funny beast. The best solution would be for me to implement all controls as custom controls or ownerdrawn controls so I can apply any style I want and have complete freedom. Sadly, that is a tremendous amount of work and I am only one person. You can see the benefits by the case of WinFBE using Jose's CXpButton as a replacement for the standard Windows button - it is so much more flexible.
Paul Squires
PlanetSquires Software

Paul Squires

Quote from: raymw on August 23, 2018, 08:01:56 PM
Experimenting with the idea of labels instead of buttons, if you mousedown and mouseup a few times on a label, (at button clicking speed) then the program shuts down.
This must have something to do with code that you have attached to those mouse events for the label? I have clicked on a label on my form a thousand times and there was no GPF.
Paul Squires
PlanetSquires Software

Paul Squires

Quote from: raymw on August 23, 2018, 07:11:16 PM
I'm also wondering what the differances are between labels and buttons, since the appearance of each and events are more or less the same. Come to think of it, why not just have forms?
Labels are meant to be static displays of text. They do not receive keyboard focus. Normally they do not respond to mouse clicks although in WinFBE I have enabled the SS_NOTIFY style so mouse clicks can be captured. I add the other mouse events as a convenience. Labels are more lightweight than a button control. You can use buttons to act like a label control. Buttons give a better visual appearance and visual movement as it is being clicked. Likewise, buttons receive keyboard input focus which is critical. Not sure what you mean by "...why not just have forms".
Paul Squires
PlanetSquires Software

raymw

Hi Paul,
Thanks for your replies.
Here is the simple complete 'testlabel.bas file. Clicking on label1 a few fastish times crashes the program. I've included the whole thing, instead of just my label/button code, in case it gives you a clue as to why it crashes.(It just changes the background color, to indicate mouse up or down)' WINFBE FORM
' WINFBE VERSION 1.7.5
' LOCKCONTROLS=False
' WINFBE FORM_START
' WINFBE CONTROL_START Form
'   PROPERTIES_START
'     PROP_NAME=Name
'     PROP_VALUE=Form1
'     PROP_NAME=Left
'     PROP_VALUE=10
'     PROP_NAME=Top
'     PROP_VALUE=10
'     PROP_NAME=Width
'     PROP_VALUE=500
'     PROP_NAME=Height
'     PROP_VALUE=300
'     PROP_NAME=Text
'     PROP_VALUE=Form1
'     PROP_NAME=WindowState
'     PROP_VALUE=FormWindowState.Normal
'     PROP_NAME=StartPosition
'     PROP_VALUE=FormStartPosition.Manual
'     PROP_NAME=BorderStyle
'     PROP_VALUE=FormBorderStyle.Sizable
'     PROP_NAME=MinimizeBox
'     PROP_VALUE=True
'     PROP_NAME=MaximizeBox
'     PROP_VALUE=True
'     PROP_NAME=ControlBox
'     PROP_VALUE=True
'     PROP_NAME=Enabled
'     PROP_VALUE=True
'     PROP_NAME=Visible
'     PROP_VALUE=True
'     PROP_NAME=BackColor
'     PROP_VALUE=SYSTEM|Control
'     PROP_NAME=AcceptButton
'     PROP_VALUE=
'     PROP_NAME=AllowDrop
'     PROP_VALUE=False
'     PROP_NAME=KeyPreview
'     PROP_VALUE=False
'     PROP_NAME=CancelButton
'     PROP_VALUE=
'     PROP_NAME=Locked
'     PROP_VALUE=False
'     PROP_NAME=MaximumHeight
'     PROP_VALUE=0
'     PROP_NAME=MaximumWidth
'     PROP_VALUE=0
'     PROP_NAME=MinimumHeight
'     PROP_VALUE=0
'     PROP_NAME=MinimumWidth
'     PROP_VALUE=0
'     PROP_NAME=ShowInTaskBar
'     PROP_VALUE=True
'     PROP_NAME=Tag
'     PROP_VALUE=
'   PROPERTIES_END
'   EVENTS_START
'   EVENTS_END
' WINFBE CONTROL_END
' WINFBE CONTROL_START Label
'   PROPERTIES_START
'     PROP_NAME=Name
'     PROP_VALUE=Label1
'     PROP_NAME=Left
'     PROP_VALUE=52
'     PROP_NAME=Top
'     PROP_VALUE=68
'     PROP_NAME=Width
'     PROP_VALUE=112
'     PROP_NAME=Height
'     PROP_VALUE=48
'     PROP_NAME=Text
'     PROP_VALUE=Label1
'     PROP_NAME=AllowDrop
'     PROP_VALUE=False
'     PROP_NAME=BackColor
'     PROP_VALUE=SYSTEM|Control
'     PROP_NAME=ForeColor
'     PROP_VALUE=SYSTEM|ControlText
'     PROP_NAME=BorderStyle
'     PROP_VALUE=ControlBorderStyle.None
'     PROP_NAME=TextAlign
'     PROP_VALUE=LabelAlignment.TopLeft
'     PROP_NAME=Font
'     PROP_VALUE=Segoe UI,9,400,0,0,0,1
'     PROP_NAME=Enabled
'     PROP_VALUE=True
'     PROP_NAME=Tag
'     PROP_VALUE=
'     PROP_NAME=Locked
'     PROP_VALUE=False
'     PROP_NAME=UseMnemonic
'     PROP_VALUE=True
'     PROP_NAME=Visible
'     PROP_VALUE=True
'   PROPERTIES_END
'   EVENTS_START
'     EVENT_NAME=MouseDown
'     EVENT_NAME=MouseUp
'   EVENTS_END
' WINFBE CONTROL_END
' WINFBE CONTROL_START Label
'   PROPERTIES_START
'     PROP_NAME=Name
'     PROP_VALUE=Label2
'     PROP_NAME=Left
'     PROP_VALUE=278
'     PROP_NAME=Top
'     PROP_VALUE=69
'     PROP_NAME=Width
'     PROP_VALUE=117
'     PROP_NAME=Height
'     PROP_VALUE=54
'     PROP_NAME=Text
'     PROP_VALUE=Label2
'     PROP_NAME=AllowDrop
'     PROP_VALUE=False
'     PROP_NAME=BackColor
'     PROP_VALUE=SYSTEM|Control
'     PROP_NAME=ForeColor
'     PROP_VALUE=SYSTEM|ControlText
'     PROP_NAME=BorderStyle
'     PROP_VALUE=ControlBorderStyle.None
'     PROP_NAME=TextAlign
'     PROP_VALUE=LabelAlignment.TopLeft
'     PROP_NAME=Font
'     PROP_VALUE=Segoe UI,9,400,0,0,0,1
'     PROP_NAME=Enabled
'     PROP_VALUE=True
'     PROP_NAME=Tag
'     PROP_VALUE=
'     PROP_NAME=Locked
'     PROP_VALUE=False
'     PROP_NAME=UseMnemonic
'     PROP_VALUE=True
'     PROP_NAME=Visible
'     PROP_VALUE=True
'   PROPERTIES_END
'   EVENTS_START
'   EVENTS_END
' WINFBE CONTROL_END
' WINFBE FORM_END
' WINFBE_CODEGEN_START
#include once "WinFormsX\WinFormsX.bi"
Declare Function Form1_Label1_MouseDown( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT
Declare Function Form1_Label1_MouseUp( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT

type Form1Type extends wfxForm
   private:
      temp as byte
   public:
      declare constructor
      ' Controls
      Label1 As wfxLabel
      Label2 As wfxLabel
end type

constructor Form1Type
   this.Text = "Form1"
   this.SetBounds(10,10,500,300)
   this.Label1.Parent = @this
   this.Label1.Text = "Label1"
   this.Label1.SetBounds(52,68,112,48)
   this.Label1.OnMouseDown = @Form1_Label1_MouseDown
   this.Label1.OnMouseUp = @Form1_Label1_MouseUp
   this.Label2.Parent = @this
   this.Label2.Text = "Label2"
   this.Label2.SetBounds(278,69,117,54)
   this.Controls.Add(ControlType.Label, @this.Label1)
   this.Controls.Add(ControlType.Label, @this.Label2)
   Application.Forms.Add(ControlType.Form, @this)
end constructor

dim shared Form1 as Form1Type
' WINFBE_CODEGEN_END

''
''  Remove the following Application.Run code if it used elsewhere in your application.
Application.Run(Form1)

''
''
Function Form1_Label1_MouseDown( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT
   form1.label1.BackColor=colors.red
   
   Function = 0
End Function

''
''
Function Form1_Label1_MouseUp( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT
   form1.label1.BackColor=colors.blue
   Function = 0
End Function



Best wishes,
Ray

raymw

Here's another gotcha. - at least for me.

Extending on my previous problem, let's compare with button behavior
''
''  Remove the following Application.Run code if it used elsewhere in your application.
Application.Run(Form1)
  dim shared   count as integer
  dim shared bcount as integer
''
''
Function Form1_Label1_MouseDown( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT
   form1.label1.BackColor=colors.red
   count=count+1
      form1.label2.Text= form1.Label2.text + " try"+ str(count)
   Function = 0
End Function

''
''
Function Form1_Label1_MouseUp( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT
   form1.label1.BackColor=colors.blue
   Function = 0
End Function

 
''
Function Form1_Load( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT
   count=0
   bcount=0
   Function = 0
End Function

''
''
Function Form1_Button1_MouseDown( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
   form1.button1.BackColor=colors.red
   bcount=bcount+1
      form1.button2.Text= form1.button2.text + " try"+ str(bcount)
   Function = 0
End Function

''
''
Function Form1_Button1_MouseUp( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
  form1.button1.BackColor=colors.blue
   Function = 0
End Function


using the mouse, slowly clicking on label 1, color changes and text added to lavbel 2, until label area gets full (or maybe some other limit I've not tested). This behaves exactly as I'd expect. I would think a button would be the same. So, I added a couple of buttons. Clicking on button1, color only changes on leaving button1, and button2 text only updates when mouse enters button2. This is not what I'd expect. Labels are better...

rainheart311

After version 1.7.3, there is such a problem: strange characters appear at the end of the Chinese menu and prompts, such as: 工具 (T) M, where M is redundant. Looking for the source code, it should be a problem with Mid, because it uses CWStr, so you need to use CWStr's MidChars function, I made such a modification, the display is normal:
     'wData = Mid(wst, i+1)
     wData = wst.MidChars(i+1)
In addition, thank you for your efforts and look forward to new progress.

Paul Squires

Quote from: raymw on August 24, 2018, 12:11:21 PM
Here's another gotcha. - at least for me.

Extending on my previous problem, let's compare with button behavior
''
''  Remove the following Application.Run code if it used elsewhere in your application.
Application.Run(Form1)
  dim shared   count as integer
  dim shared bcount as integer
''
''
Function Form1_Label1_MouseDown( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT
   form1.label1.BackColor=colors.red
   count=count+1
      form1.label2.Text= form1.Label2.text + " try"+ str(count)
   Function = 0
End Function

''
''
Function Form1_Label1_MouseUp( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT
   form1.label1.BackColor=colors.blue
   Function = 0
End Function

 
''
Function Form1_Load( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT
   count=0
   bcount=0
   Function = 0
End Function

''
''
Function Form1_Button1_MouseDown( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
   form1.button1.BackColor=colors.red
   bcount=bcount+1
      form1.button2.Text= form1.button2.text + " try"+ str(bcount)
   Function = 0
End Function

''
''
Function Form1_Button1_MouseUp( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
  form1.button1.BackColor=colors.blue
   Function = 0
End Function


using the mouse, slowly clicking on label 1, color changes and text added to lavbel 2, until label area gets full (or maybe some other limit I've not tested). This behaves exactly as I'd expect. I would think a button would be the same. So, I added a couple of buttons. Clicking on button1, color only changes on leaving button1, and button2 text only updates when mouse enters button2. This is not what I'd expect. Labels are better...

Yeah, something seems odd there. I need to trace the sequence of messages between Windows and the CXpButton control. Also, in MouseDown you should probably be setting the BackColorDown property rather than the BackColor property. Have you tried setting the properties via the PropertyList to see if gives you the result you are looking for when the mouse is pressed and released (by setting the properties in the Property List, BackColor, BackColorDown, etc).
Paul Squires
PlanetSquires Software

Paul Squires

Quote from: raymw on August 24, 2018, 11:35:46 AM
Hi Paul,
Thanks for your replies.
Here is the simple complete 'testlabel.bas file. Clicking on label1 a few fastish times crashes the program. I've included the whole thing, instead of just my label/button code, in case it gives you a clue as to why it crashes.(It just changes the background color, to indicate mouse up or down)' WINFBE FORM
' WINFBE VERSION 1.7.5
' LOCKCONTROLS=False
' WINFBE FORM_START
' WINFBE CONTROL_START Form
'   PROPERTIES_START
'     PROP_NAME=Name
'     PROP_VALUE=Form1
'     PROP_NAME=Left
'     PROP_VALUE=10
'     PROP_NAME=Top
'     PROP_VALUE=10
'     PROP_NAME=Width
'     PROP_VALUE=500
'     PROP_NAME=Height
'     PROP_VALUE=300
'     PROP_NAME=Text
'     PROP_VALUE=Form1
'     PROP_NAME=WindowState
'     PROP_VALUE=FormWindowState.Normal
'     PROP_NAME=StartPosition
'     PROP_VALUE=FormStartPosition.Manual
'     PROP_NAME=BorderStyle
'     PROP_VALUE=FormBorderStyle.Sizable
'     PROP_NAME=MinimizeBox
'     PROP_VALUE=True
'     PROP_NAME=MaximizeBox
'     PROP_VALUE=True
'     PROP_NAME=ControlBox
'     PROP_VALUE=True
'     PROP_NAME=Enabled
'     PROP_VALUE=True
'     PROP_NAME=Visible
'     PROP_VALUE=True
'     PROP_NAME=BackColor
'     PROP_VALUE=SYSTEM|Control
'     PROP_NAME=AcceptButton
'     PROP_VALUE=
'     PROP_NAME=AllowDrop
'     PROP_VALUE=False
'     PROP_NAME=KeyPreview
'     PROP_VALUE=False
'     PROP_NAME=CancelButton
'     PROP_VALUE=
'     PROP_NAME=Locked
'     PROP_VALUE=False
'     PROP_NAME=MaximumHeight
'     PROP_VALUE=0
'     PROP_NAME=MaximumWidth
'     PROP_VALUE=0
'     PROP_NAME=MinimumHeight
'     PROP_VALUE=0
'     PROP_NAME=MinimumWidth
'     PROP_VALUE=0
'     PROP_NAME=ShowInTaskBar
'     PROP_VALUE=True
'     PROP_NAME=Tag
'     PROP_VALUE=
'   PROPERTIES_END
'   EVENTS_START
'   EVENTS_END
' WINFBE CONTROL_END
' WINFBE CONTROL_START Label
'   PROPERTIES_START
'     PROP_NAME=Name
'     PROP_VALUE=Label1
'     PROP_NAME=Left
'     PROP_VALUE=52
'     PROP_NAME=Top
'     PROP_VALUE=68
'     PROP_NAME=Width
'     PROP_VALUE=112
'     PROP_NAME=Height
'     PROP_VALUE=48
'     PROP_NAME=Text
'     PROP_VALUE=Label1
'     PROP_NAME=AllowDrop
'     PROP_VALUE=False
'     PROP_NAME=BackColor
'     PROP_VALUE=SYSTEM|Control
'     PROP_NAME=ForeColor
'     PROP_VALUE=SYSTEM|ControlText
'     PROP_NAME=BorderStyle
'     PROP_VALUE=ControlBorderStyle.None
'     PROP_NAME=TextAlign
'     PROP_VALUE=LabelAlignment.TopLeft
'     PROP_NAME=Font
'     PROP_VALUE=Segoe UI,9,400,0,0,0,1
'     PROP_NAME=Enabled
'     PROP_VALUE=True
'     PROP_NAME=Tag
'     PROP_VALUE=
'     PROP_NAME=Locked
'     PROP_VALUE=False
'     PROP_NAME=UseMnemonic
'     PROP_VALUE=True
'     PROP_NAME=Visible
'     PROP_VALUE=True
'   PROPERTIES_END
'   EVENTS_START
'     EVENT_NAME=MouseDown
'     EVENT_NAME=MouseUp
'   EVENTS_END
' WINFBE CONTROL_END
' WINFBE CONTROL_START Label
'   PROPERTIES_START
'     PROP_NAME=Name
'     PROP_VALUE=Label2
'     PROP_NAME=Left
'     PROP_VALUE=278
'     PROP_NAME=Top
'     PROP_VALUE=69
'     PROP_NAME=Width
'     PROP_VALUE=117
'     PROP_NAME=Height
'     PROP_VALUE=54
'     PROP_NAME=Text
'     PROP_VALUE=Label2
'     PROP_NAME=AllowDrop
'     PROP_VALUE=False
'     PROP_NAME=BackColor
'     PROP_VALUE=SYSTEM|Control
'     PROP_NAME=ForeColor
'     PROP_VALUE=SYSTEM|ControlText
'     PROP_NAME=BorderStyle
'     PROP_VALUE=ControlBorderStyle.None
'     PROP_NAME=TextAlign
'     PROP_VALUE=LabelAlignment.TopLeft
'     PROP_NAME=Font
'     PROP_VALUE=Segoe UI,9,400,0,0,0,1
'     PROP_NAME=Enabled
'     PROP_VALUE=True
'     PROP_NAME=Tag
'     PROP_VALUE=
'     PROP_NAME=Locked
'     PROP_VALUE=False
'     PROP_NAME=UseMnemonic
'     PROP_VALUE=True
'     PROP_NAME=Visible
'     PROP_VALUE=True
'   PROPERTIES_END
'   EVENTS_START
'   EVENTS_END
' WINFBE CONTROL_END
' WINFBE FORM_END
' WINFBE_CODEGEN_START
#include once "WinFormsX\WinFormsX.bi"
Declare Function Form1_Label1_MouseDown( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT
Declare Function Form1_Label1_MouseUp( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT

type Form1Type extends wfxForm
   private:
      temp as byte
   public:
      declare constructor
      ' Controls
      Label1 As wfxLabel
      Label2 As wfxLabel
end type

constructor Form1Type
   this.Text = "Form1"
   this.SetBounds(10,10,500,300)
   this.Label1.Parent = @this
   this.Label1.Text = "Label1"
   this.Label1.SetBounds(52,68,112,48)
   this.Label1.OnMouseDown = @Form1_Label1_MouseDown
   this.Label1.OnMouseUp = @Form1_Label1_MouseUp
   this.Label2.Parent = @this
   this.Label2.Text = "Label2"
   this.Label2.SetBounds(278,69,117,54)
   this.Controls.Add(ControlType.Label, @this.Label1)
   this.Controls.Add(ControlType.Label, @this.Label2)
   Application.Forms.Add(ControlType.Form, @this)
end constructor

dim shared Form1 as Form1Type
' WINFBE_CODEGEN_END

''
''  Remove the following Application.Run code if it used elsewhere in your application.
Application.Run(Form1)

''
''
Function Form1_Label1_MouseDown( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT
   form1.label1.BackColor=colors.red
   
   Function = 0
End Function

''
''
Function Form1_Label1_MouseUp( ByRef sender As wfxLabel, ByRef e As EventArgs ) As LRESULT
   form1.label1.BackColor=colors.blue
   Function = 0
End Function



Best wishes,
Ray


Yes, for some reason the DoubleClick on the Label is causing a GPF.
Paul Squires
PlanetSquires Software

Paul Squires

Quote from: rainheart311 on August 24, 2018, 11:39:05 PM
After version 1.7.3, there is such a problem: strange characters appear at the end of the Chinese menu and prompts, such as: 工具 (T) M, where M is redundant. Looking for the source code, it should be a problem with Mid, because it uses CWStr, so you need to use CWStr's MidChars function, I made such a modification, the display is normal:
     'wData = Mid(wst, i+1)
     wData = wst.MidChars(i+1)
In addition, thank you for your efforts and look forward to new progress.

I have changed the code in LoadLocalizationFile to the code you have suggested. Hopefully it results in the correct string being displayed for you.
Paul Squires
PlanetSquires Software

José Roca

You can also try wData = Mid(**wst, i+1). The Free Basic native string functions have always been problematic without the use of **.

rainheart311

Thank you, Paul.
I don't know why, use
      'wData = Mid(wst, i+1)
      wData = wst.MidChars(i+1)
After this change, there will be a situation of collapse during storage, and use
      'wData = Mid(wst, i+1)
      wData = Mid(**wst, i+1)
There is no problem with this change.

raymw

Hi Paul,
QuoteAlso, in MouseDown you should probably be setting the BackColorDown property rather than the BackColor property. Have you tried setting the properties via the PropertyList to see if gives you the result you are looking for when the mouse is pressed and released (by setting the properties in the Property List, BackColor, BackColorDown, etc).
Not on this version, but that worked OK in previous versions (I'd not tried the mousedown/mouseup as above in previous versions,iirc. ) I was just following up on my 'argument' that I didn't see the point of labels duplicating the functionality of buttons and was trying to test if both are capable of doing the same thing with more or less the same code.