dm script - How to close a UIFrame window from the object itself? (Behavioral difference GMS 1.x to GMS 2.x) -


In GMS2.x, closing the UIFrame window with the code shown below will cause DM to crash ( close button.)

However, the same code works fine with GMS 1.x.

Is there any way to work this problem in GMS 2.x?

  category UIWindowCloseTest: UIFrame {void CloseSelf (object itself) self.GetFrameWindow (). WindowClose (0); UIWindowCloseTest (object itself) {tag group tgDialog = DLGCreateDialog ("close window test"); TgDialog.DLGAddElement (DLGCreatePushButton ("Closed", "Close")); Self.super.init (tgDialog); Self. Performance ("test"); Results (self.ScriptObjectGetID). Hex () + "created \ n"); }; ~ UIWindowCloseTest (object itself) \ result (self.ScriptObjectGetID) .hex () + "deleted \ n \ n"); }; Alloc (UIWindowCloseTest);  

This question is expanded to GMS 3.x:

In essence, the GMS 3 is also correct, but since its version 3.2 (maybe also GMS 3.1.2)

There is a bug in the first version of GMS3 as KeVIV responded in a comment in the reply.

However, there is a solution around this one, which is slightly more elaborate: my DLG (Object Self) result ("kill \ n DLG") zero deferred result (object self) result ("Create \ ndlg"). {Taggroup tgs = GetPersistentTagGroup () number script id if (tgs.TagGroupGetTagAsLong ("DummyTag_CloseWindow_ID", script ID)} {object obj = GetScriptObjectFromID (scriptID) if (obj.ScriptObjectIsValid ()) {obj.GetFrameWindow () WindowClose (0) back}} Debug ("\ n Sorry, but the dialog can not be closed.") Zero closed Button object (Object itself) {// Generally, it's "self.close ()" here , // will be saved to use, it is not possible in CRL 3.1 // Alternative way to get the UIframe object window // and close it, okay, but it should not be called directly here, / / Or it will crash DAM // for a job As an attachment, one can store an object ID and a different // thread can lift it, get the object, and close the window of the object. // This is what we are doing below: // Tag script tags tag tggs = GetPersistentTagGroup () tgs.TagGroupSetTagAsLong ("DummyTag_CloseWindow_ID", self.ScriptObjectGetID ()) // Close the thread to launch different threads. .. (0.1 seconds delay for security) AddMainThreadSingleTask (self, "deferred close" {0}} taggroup work DLG ​​(object self) {taggraph DLGTG, DLGTGITs DLAGTG = DLGredit diallieg ("My Dialog", DLGTGITs), DLGTGITs. Return to DLGTG}} {Object Dialogue = Alloc (myDLG) dialog.Init (dialog.CreateDLG ()) dialog.display (""}} / Pre>


Such:

  • For GMS 3.2 and later: self.close ();

  • Use for GMS 3.0 and 3.1 (with bugs): Use workaround

  • For GMS 2.x: Using self.close ()

  • 1.x for GMS: Self Gate FrameWindow (.) WindowClose (0);


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -