[Gambas-user] Workspace event question

richard terry rterry at ...1823...
Tue Nov 19 23:03:01 CET 2013


On 20/11/13 08:49, Tobias Boege wrote:
> On Wed, 20 Nov 2013, richard terry wrote:
>> Hi List,
>>
>> Think I posted this a week ago but got no reply, maybe I sent it from
>> the wrong address.
>>
>> Anway, I've got a workspace which I use to place forms each on a new tab.
>>
>> I wondered if there was anyway to intercept the close event of the tab,
>> so that one can action something on a form before it/the tab is removed,
>> or cancel the close
>>
>> Thanks in anticipation
>>
>> richard
> You can define the Form_Close() event handler in the Forms you want to embed
> into the Workspace. There you can react on the closing of the Form (which is
> triggered when closing the tab). Apparently, you can also use Stop Event to
> make the Workspace not close the tab. In my test project, it worked.

Maybe you could show me the code (mine which failed is below)
>
> Regards,
> Tobi
>
> ------------------------------------------------------------------------------
> Shape the Mobile Experience: Free Subscription
> Software experts and developers: Be at the forefront of tech innovation.
> Intel(R) Software Adrenaline delivers strategic insight and game-changing
> conversations that shape the rapidly evolving mobile landscape. Sign up now.
> http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
Thanks Benoit, Tobias, I did already try both these suggestions, maybe 
my code was wrong (enclosed - this didn't work), will retry and report back

Public Sub Form_Close()

    ' If VBox_Letters.Padding Then  'letter content has changed
    '    If Message.Question("Do you wish to close the Referrals without 
saving your current letter?", "Yes", "No") = 2 Then
    '       Stop Event
    '       Return
    '    Else
    '       Save()
    '    Endif
    ' End If

End


richard






More information about the User mailing list