• Welcome to PlanetSquires Forums.
 

WinFBE 2.1.9 - MessageBox

Started by SeaVipe, March 28, 2021, 04:20:20 PM

Previous topic - Next topic

SeaVipe

Hi Paul, in 2.1.9 I've had to add MB_APPLMODAL to MessageBox to make the box modal in a child dialog (not a parent dialog). Otherwise, the ALT key must be tapped to display the MessageBox. This is different behaviour from previous releases of WinFBE. With MB_APPLMODAL added, MessageBox works as expected when called from a child dialog.
Clive Richey

Paul Squires

Thanks Clive, I'll have to test that because I am pretty sure that there is nothing that was changed in the WinFormsX library that would affect this. I will generate a test project and see what the you are referring to about the ALT key, etc.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

#2
Thanks, Paul.
On another note, the DateTimePicker control is unresponsive to user input. A form with the DTP control loses the cursor while the control has focus. However, any keystrokes or UpDown clicks are actually doing what the user is wanting but the changes do not appear on the control. Close the form and reopen it and the result of those user changes is accurate (the underlying code saves the edits to file and applies those values to the DTP control each time the dialog is opened).
This behaviour is inconsistent as occasionally the control will work properly but I haven't been able to determine the sequence of events that causes it.
There are 2 DTP controls on the same form.

[UPDATE] 25-Apr-2021
The above-mentioned form also has a MonthCalendar control. The DateTimePicker control works as designed if the MonthCalendar control is clicked before the DateTimePicker control.
Clive Richey

Paul Squires

Quote from: SeaVipe on March 28, 2021, 04:20:20 PM
Hi Paul, in 2.1.9 I've had to add MB_APPLMODAL to MessageBox to make the box modal in a child dialog (not a parent dialog). Otherwise, the ALT key must be tapped to display the MessageBox. This is different behaviour from previous releases of WinFBE. With MB_APPLMODAL added, MessageBox works as expected when called from a child dialog.

Hi Clive, I am trying to troubleshoot your question. How are you calling the MessageBox? Can you show me the function call you are using? Are you passing the window handle of your popup form to the MessageBox so that the MessageBox treats the popup form as its parent?


''
''
Function frmPopup_Button1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
   MessageBox( sender.hWindow, "My Message", "My Caption", MB_OK )
   Function = 0
End Function


Also, this phrase confuses me "Otherwise, the ALT key must be tapped to display the MessageBox". Why would you have to trap the ALT key?

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Quote from: SeaVipe on March 28, 2021, 08:11:11 PM
On another note, the DateTimePicker control is unresponsive to user input. A form with the DTP control loses the cursor while the control has focus. However, any keystrokes or UpDown clicks are actually doing what the user is wanting but the changes do not appear on the control. Close the form and reopen it and the result of those user changes is accurate (the underlying code saves the edits to file and applies those values to the DTP control each time the dialog is opened).
This behaviour is inconsistent as occasionally the control will work properly but I haven't been able to determine the sequence of events that causes it.
There are 2 DTP controls on the same form.
My simple test project can not duplicate your experience. Are you doing anything behind the scenes to try to trap keys, filter keys, or manually set focus to controls based on user movements, etc ?
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

Hi Paul, What I just discovered was that the issue is being exacerbated by my use of a second monitor. The problem goes away when the child form is dragged to the same monitor as the parent form.
In my use of the app, the main form is on monitor #2, off to my right. The child/editing form is opened on monitor #1 (default monitor) directly in front of me. And this is where the problem occurs and it only occurs once per session. The second and subsequent times a MessageBox is called it pops up without issue. Close the app then restart the app and try MessageBox again and the issue returns.
I stumbled upon the ALT key when I attempted to ALT/Tab to some other open Window (when the child form is on a different monitor to the parent form while the MessageBox was hidden). Pressing the ALT key showed the MessageBox before I had a chance to press the Tab key.
Here's what I have so far:
Parent on Monitor #1, Child on Monitor #1                         - MessageBox functions normally
Parent on Monitor #1, Child dragged to Monitor #2             - MessageBox functions normally
Parent on Monitor #2, Child on Monitor #1                         - MessageBox hidden. Press the ALT key to show MessageBox
Parent on Monitor #2, Child dragged to Monitor #2             - MessageBox functions normally
Parent dragged to Monitor #2, Child dragged to Monitor #2 - MessageBox hidden. Press the ALT key to show MessageBox


The parent screen position is set in frmMainJ_Load using values from an ini file.
Because of the way Windows handles multiple monitors, I've had to hard code the Child screen position to monitor #1 so the child must be dragged to monitor #2 for the above experiments.
I hope this helps to clarify my PP.
Clive Richey