PlanetSquires Forums

Support Forums => WinFBE - Code Editor and Visual Designer => Topic started by: SeaVipe on March 04, 2020, 05:12:02 PM

Title: WinFBE 2.0.7 - Frame
Post by: SeaVipe on March 04, 2020, 05:12:02 PM
Hi Paul, In a new project, there is 1 frame on a form. Modifying the Text property prior to modifying the Form's Text property from Form_Load works but modifying the Frame's Text property a second time, the frame disappears.
If I reverse the order of the 2 calls, frmMain.Text = "Some text" before frmMain.Frame1.Text = "Some text" then the frame will not disappear regardless of where its called from.




Title: Re: WinFBE 2.0.7 - Frame
Post by: Paul Squires on March 04, 2020, 09:26:52 PM
Hi Clive, thanks for the report. I am trying to replicate the problem but have not yet been successful. I create a simple new project and added a Frame and a Button. Here is the code but the frame does not disappear. I am using 2.0.6.
Code: [Select]
''
''
Function frmMain_Load( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT
   frmMain.Frame1.Text = "Frame new text"
   frmMain.Text = "Form Name modified"
   frmMain.Frame1.Text = "Frame New Load Text"
   Function = 0
End Function

''
''
Function frmMain_Button1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
   frmMain.Frame1.Text = "FrameText from Button"
   Function = 0
End Function

Title: Re: WinFBE 2.0.7 - Frame
Post by: SeaVipe on March 05, 2020, 12:59:16 PM
Hi Paul,
This hides the frame:
Code: [Select]
Function frmMain_Button1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
    frmMain.Frame1.Text = "FrameText from Button"
    '' Modifying the form's text here will hide the frame
    frmMain.Text = "FormText from button"
    Function = 0
End Function
Reverse the order of the 2 lines of code:

Code: [Select]
Function frmMain_Button1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
    '' Modifying the form's text here will NOT hide the frame
    frmMain.Text = "FormText from button"
    frmMain.Frame1.Text = "FrameText from Button"
    Function = 0
End Function
Also, I added a second button that does not hide the frame (like the second example code) and when clicked it restores the frame, if hidden, and displays the new text. I'm using WinFBE 2.0.7
Title: Re: WinFBE 2.0.7 - Frame
Post by: Paul Squires on March 05, 2020, 01:32:59 PM
Thanks Clive - yes, I see the problem now using your code. Looks like when I call AfxRedrawWindow in the Text set property of the base wfxControl class that it causes the frame to disappear. If I comment out that function call then the frame does not vanish.

Code: [Select]
property wfxControl.Text( byref nValue as wstring )
   if this.hWindow then
      AfxSetWindowText(this.hWindow, nValue)
      AfxRedrawWindow(this.hWindow)   '<--- this is causing the frame issue
   End If   
   _Text = nValue
end property

I might just add a Text property to the wfxForm class in order to override the base wfxControl call. I can't remember why I added AfxRedrawWindow after the call to AfxSetWindowText but I must have done so for a reason....maybe there was another control that needed the window refresh after setting the text. I can't remember at this point.