Page 1 of 1

How to prevent form being minimised

Posted: Saturday 12th December 2020 2:56pm
by bill-lancaster
I have a project that shows calendar events on screen. The form has border false and skiptaskbar true.
This fine until a minimise key (WIN + PgDn) sequence is sent, resulting the programme's disappearance!
How can I intercept the minimise action?

Re: How to prevent form being minimised

Posted: Saturday 12th December 2020 3:51pm
by cogier
I can't get the key combination [Win]+[PgDn] to work but try the following: -
Public Sub Form_Deactivate()
  
  Me.Activate

End

Re: How to prevent form being minimised

Posted: Saturday 12th December 2020 4:10pm
by bill-lancaster
Thanks cogier, I'll try it.
I also think this does the job

Code: Select all

Public Sub Form_LostFocus()
  Me.Minimized = False
End

Re: How to prevent form being minimised

Posted: Saturday 12th December 2020 6:24pm
by bill-lancaster
This works:-

Code: Select all

Public Sub Form_State()
  If Me.Minimized Then Me.Minimized = False
End

Re: How to prevent form being minimised

Posted: Sunday 13th December 2020 3:18am
by BruceSteers
Setting a Forms "Utility" property to true in the IDE will hide the minimize button.

I don't know if it stops the minimising though, worth a try.
that sounds like an odd shortcut set somewhere else as it is not Gambas default to minimise on Super+PgDown

Re: How to prevent form being minimised

Posted: Sunday 13th December 2020 4:35am
by BruceSteers
Well i discovered Meta + PageDown is a LXDE KDE thing.

I don't have any of those systems to try it on but..

You could also try something like this...

Public Sub Form_KeyPress()

If Key.Meta And If Key.PageDown Then Stop event

End

Re: How to prevent form being minimised

Posted: Sunday 13th December 2020 7:25am
by bill-lancaster
Sorry, I forgot that I've always set Meta + PageDown as a custom shortcut for window minimise