How to prevent form being minimised

Post your Gambas programming questions here.
Post Reply
bill-lancaster
Posts: 190
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

How to prevent form being minimised

Post 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?
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: How to prevent form being minimised

Post by cogier »

I can't get the key combination [Win]+[PgDn] to work but try the following: -
Public Sub Form_Deactivate()
  
  Me.Activate

End
bill-lancaster
Posts: 190
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: How to prevent form being minimised

Post 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
bill-lancaster
Posts: 190
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: How to prevent form being minimised

Post by bill-lancaster »

This works:-

Code: Select all

Public Sub Form_State()
  If Me.Minimized Then Me.Minimized = False
End
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: How to prevent form being minimised

Post 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
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: How to prevent form being minimised

Post 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
If at first you don't succeed , try doing something differently.
BruceS
bill-lancaster
Posts: 190
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: How to prevent form being minimised

Post by bill-lancaster »

Sorry, I forgot that I've always set Meta + PageDown as a custom shortcut for window minimise
Post Reply