ON SIZE bug in a MODAL Window with a menu

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

ON SIZE bug in a MODAL Window with a menu

Post by trmpluym »

Dear HMG friends,

Last week my good friend Ben Dekker asked me a question regarding the 'ON SIZE' event using a MODAL window.

When a MODAL window is used with a menu, a resize event is incorrectly triggered when the window is opened.

Normally a resize event is only triggered when the user tries to resize a window. According Ben and my selves this should not happen. When using a MAIN window ( with or without menu ) this unwanted behavior does not occur. Also when using a MODAL window without menu everything works a expected.

To demonstrate the problem I created a demo ( see attachment ). The demo starts a MAIN window ( with a menu ). When the demo is started the main window will open without firing the resize event ( like it should ). When you try to resize the window the resize event is correctly triggered.

On the MAIN window there are 2 buttons:

The first button opens a MODAL window WITHOUT menu. When you try to resize the window the resize event is correctly triggered.

Until now everything works like it should ! The problem starts here:

The second button opens a MODAL window WITH menu. Directly after opening the the window, the resize event is incorrectly triggered (without doing a resize).

So our conclusion is this behavior is probably a bug. Or is there another explanation ?

Best regards,

Theo
Attachments
ResizeBugDemo.zip
(1.47 MiB) Downloaded 75 times
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: ON SIZE bug in a MODAL Window with a menu

Post by trmpluym »

Dear friends,

I am still struggling with this basic issue. I also found out the problem occurs in both the latest versions of HMG and MiniGui ?

Maybe Grigory or Rathi can have a look ?

Thanks in advance !

Theo
edk
Posts: 911
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: ON SIZE bug in a MODAL Window with a menu

Post by edk »

Try this code:

Code: Select all

Function ModalWindowNotOK()

DEFINE WINDOW wndModalWindowWithMenu ;
   AT 0,0 ;
   WIDTH 400 ;
   HEIGHT 650 ;
   TITLE "MODAL Window WITH MENU ( try to resize )";
   MODAL;
   ON SIZE { || IF (IsWindowActive (wndModalWindowWithMenu), msgdebug("ON SIZE is triggered to early because of the MENU"), Nil ) }

DEFINE MAIN MENU
   POPUP 'Menu'
      ITEM 'Dummy menu item' ACTION MsgDebug("TEST")
   END POPUP
END MENU

END WINDOW

CENTER WINDOW wndModalWindowWithMenu
ACTIVATE WINDOW wndModalWindowWithMenu

RETURN(nil)
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: ON SIZE bug in a MODAL Window with a menu

Post by trmpluym »

Hi Edk,

Thanks, your work-a-round works fantastic :D

I just called my friend Ben and you have made his day !

Let's hope Grigory and Rathi can implement this bug fix in the next release of HMG and MiniGui.

Theo
User avatar
gfilatov
Posts: 1066
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: ON SIZE bug in a MODAL Window with a menu

Post by gfilatov »

trmpluym wrote: Sun Apr 11, 2021 2:32 pm Hi Edk,

Thanks, your work-a-round works fantastic :D

I just called my friend Ben and you have made his day !

Let's hope Grigory and Rathi can implement this bug fix in the next release of HMG and MiniGui.
Hi Theo,

It will be fixed at the next MiniguiEx update (thanks to Edk's tip :idea: ).

Thank you for your attention.
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: ON SIZE bug in a MODAL Window with a menu

Post by trmpluym »

Grigory,

Great to hear and thanks for following up !

Theo
Post Reply