[Gambas-user] Turn off window modality while its showing?
Gianluigi
gradobag at gradobag.it
Mon Jan 15 14:37:38 CET 2024
Il 15/01/24 13:46, Bruce Steers ha scritto:
>
>
> On Mon, 15 Jan 2024 at 08:00, BB <adamnt42 at gmail.com> wrote:
>
> I have a lot of image files that I show in a modal popup form. Now I
> want to stop an instance of the form being modal, so I can select
> another image and pop it up as well (so I can compare them). Any
> ideas?
>
> b
>
>
> maybe a pseudo modal window will do it?
>
> This ShowModal override should open in Utility mode and work like a
> modal form but setting $bPseudo to false while it's open will break it
> out of utility mode.
>
> Private $bPseudo As Boolean ' Modal switch
> Private $hWin As Window ' parent form to disable
> Private $iValue As Integer ' the standard Modal return value holder.
>
> Public Sub UnModal()
>
> $bPseudo = False
>
> End
>
>
> Public Sub ShowModal() As Integer
>
> $hWin = Application.ActiveWindow ' probably better to explicitly
> use the parent form object here.
>
> Dim bEnabled As Boolean = $hWin.Enabled ' note parent window
> enabled state before making it false
> $hWin.Enabled = False
> $bPseudo = True
> Me.Utility = True
> Super.Show()
> While Object.IsValid(Me) And $bPseudo ' wait for window close or
> unmodal request, letting event loop run.
> Wait 0.1
> Wend
>
> If Object.IsValid(Me) Then Me.Utility = $bPseudo
>
> If Object.IsValid($hWin) Then
> $hWin.Enabled = bEnabled
> Endif
>
> Return $iValue
>
> End
>
> Public Sub Button2_Click()
>
> $bPseudo = False
>
> End
>
> Something along those lines maybe?
>
> Respects
> BruceS
>
>
> ----[http://gambaswiki.org/wiki/doc/netiquette ]----
I would use the property Staking = 1 and a simple Show on all windows.
Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20240115/7cee1c28/attachment-0001.htm>
More information about the User
mailing list