![]() | Programming Guide | WideStudio/MWT Index Table of contents |
EXIT Æ®¸®°Å(trigger)¿¡ÀÇÇÑ Á¾·á À̺¥Æ® ÇÁ·Î½ÃÀú¿¡¼ ´ëÈ »óÀÚ¸¦ Ç¥½ÃÇϱ⿡´Â
À©µµ¿ì¸¦ ´Ý°í ÀÀ¿ëÇÁ·Î±×·¥À» Á¾·áÇÏ´Â °æ¿ì µ¥ÀÌÅÍÀÇ ÀúÀåÀ» ½ÇÇàÇÏ°í³ª Á¾·áÇÒ°¡ ¸»°¡¸¦ ´ëÈ »óÀڷΠǥ½ÃÇÒ °æ¿ì°¡ ÀÖ½À´Ï´Ù. ±×·² °æ¿ì WSCwindow / WSCmainWindow Ŭ·¡½ºÀÇ EXIT Æ®¸®°Å(trigger)·Î À̺¥Æ® ÇÁ·Î½ÃÀú ¸¦ ÀÌ¿ëÇÏ¸é º¯¸®ÇÕ´Ï´Ù. WSCwindow/WSCmainWindow Ŭ·¡½º´Â À©µµ¿ì°¡ ºÒ°¡½Ã »óÅ¿¡µÈ °æ¿ì¿¡ EXIT Æ®¸®°Å(trigger)¸¦ ºÒ·¯ ÀÀ¿ëÇÁ·Î±×·¥°¡ Á¾·áÇϱâ Àü¿¡ À̺¥Æ® ÇÁ·Î½ÃÀú¸¦ ½ÇÇàÇÒ ±â´ÉÀ» °¡Áö°íÀÖ½À´Ï´Ù.
¸ÕÀú WSCwindow ȤÀº WSCmainWindow Ŭ·¡½ºÀÇ ¼Ó¼º "exit"À» True ·Î ÇÕ´Ï´Ù. ÀÌ ¼Ó¼ºÀº ÀÀ¿ëÇÁ·Î±×·¥ÁßÀÇ À©µµ¿ì¿¡¼ ƯÈ÷ ¸ÞÀηΠÀÌ¿ëµÇ´Â°Í¿¡ ¼³Á¤Çϸé ÁÁÀ»°ÍÀÔ´Ï´Ù. ±×·¡¼ ±× À©µµ¿ì¿¡ ´ëÇØ¼ EXIT Æ®¸®°Å·Î À̺¥Æ® ÇÁ·Î½ÃÀú¸¦ ºÙ¿©³õ½À´Ï´Ù.
´ÙÀ½°ú °°Àº ±â´ÉÀ» °¡Áö´Â À̺¥Æ® ÇÁ·Î½ÃÀú¸¦ ¸¸µé¾îº¾½Ã´Ù.
Á¾·áÇÒ°¡ ¸»°¡ÀÇ ´ëÈ »óÀÚ¸¦ Ç¥½Ã. [OK]°¡ ¼±ÅÃµÈ °æ¿ì´Â 󸮸¦ ½ÇÇàÇØ¼ Á¾·á. [NO]°¡ ¼±ÅÃµÈ °æ¿ì´Â 󸮸¦ ¾ÈÇϰí Á¾·á. [CANCEL]°¡ ¼±ÅÃµÈ °æ¿ì´Â 󸮸¦ ¾ÈÇϰí Á¾·áµµ ¾ÈÇÔ. //in delayproc.java //---------------------------------------------------------- //Function for the event procedure //---------------------------------------------------------- import org.widestudio.mwt.*; // «ª°´Ã¼¸¦ ´Ù½Ã Ç¥½ÃÇϴ ŸÀÌ¸Ó ÇÁ·Î½ÃÀú public class delayproc { static WSCvtimer timer = null; static WSCbase target = null; protected static void delayproc(WSCbase object){ if (target != null){ target.setVisible((short)Mwt.True); } } } //in exit_ep.java //---------------------------------------------------------- //Function for the event procedure //---------------------------------------------------------- import org.widestudio.mwt.*; // EXIT À̺¥Æ® ÇÁ·Î½ÃÀúº»Ã¼ // Á¾·á½Ã¿¡´Â ´ëÈ »óÀÚ¸¦ Ç¥½ÃÇÑ´Ù. public class exit_ep { protected static void exit_ep(WSCbase object){ if (object.getVisible() != Mwt.False){ return; } WSCmessageDialog msg = Mwt.WSGIappMessageDialog(); //A msg.setProperty("width",500); msg.setProperty("no",Mwt.True); msg.setProperty("defaultPosition",Mwt.True); msg.setProperty("labelString", "Exit and save data?\n If you do not want to save and exit,push NO..."); // ´ëÈ »óÀÚÀÇ Ç¥½Ã long ret = msg.popup(); //B // ù ¹øÂ° ½ÇÇà½Ã, ŸÀ̸Ӹ¦ ÀÛ¼º if (delayproc.timer == null){ WSCbase parent = object.getParentWindow(); delayproc.timer = new WSCvtimer(parent,"objname"); delayproc.timer.init(); delayproc.timer.setVariantData("variable_name","delayproc.timer"); delayproc.timer.setProperty("interval",250); delayproc.timer.setProperty("cont",Mwt.False); delayproc.timer.addProcedure("delay-popup","delayproc.delayproc",Mwt.WSEV_ACTIVATE); } if (ret == Mwt.WS_DIALOG_OK){ // OK ´ÜÃß°¡ ´¸° °æ¿ì C // saving some data ... System.exit(0); }else if (ret == Mwt.WS_DIALOG_NO){ // NO ´ÜÃß°¡ ´¸° °æ¿ì D System.exit(0); }else if (ret == Mwt.WS_DIALOG_CANCEL){ // CANCEL ´ÜÃß°¡ ´¸° °æ¿ì E delayproc.target = object; delayproc.timer.setProperty("running",Mwt.True); // ŸÀ̸Ӹ¦ ±âµ¿ } } }A ¿¡¼ ¸Þ½ÃÁö ´ëÈ »óÀÚ ÀνºÅϽº¸¦ ÃëµæÇØ¼ B ¿¡¼ ¸Þ½ÃÁö ´ëÈ »óÀÚ¸¦ Ç¥½ÃÇÕ´Ï´Ù.
C,D,E ¿¡¼ ´ëÈ »óÀÚÀÇ °á°ú¸¦ ÆÇÁ¤Çؼ OK ´ÜÃß°¡ ´·ÈÀ¸¸é C, NO ´ÜÃß°¡ ´·ÈÀ¸¸é D, CANCEL ´ÜÃß°¡ ´·ÈÀ¸¸é E ·Î µË´Ï´Ù.
E ÀÇ Á¾·á¾ÈÇÏ°í ´Ù½Ã Ç¥½ÃÇÒ °æ¿ì, ŸÀ̸Ӹ¦ ¾²°í, Á» ŸÀ̹ÖÀ» ´ÊÃâÇʿ䰡 ÀÖ½À´Ï´Ù. À̰ÍÀº À©µµ¿ì ½Ã½ºÅÛ¿¡ ´ëÇØ ¹Ì¸® ȸéÁ¾·á À̺¥Æ®°¡ ¹ß»ýÇϰíÀÖÀ¸¹Ç·Î ±× À̺¥Æ®ÀÇ Ã³¸®°¡ È®½ÇÈ÷ 󸮵ǿ´´Ù°¡ Ç¥½Ã¸¦ ½ÇÇàÇá¿©¾ßÇϱ⶧¹®ÀÔ´Ï´Ù.
£Û Á¾·á È®ÀÎ ´ëÈ »óÀÚ£Ý
Copyright(C) WideStudio/MWT Development Team, 1999-2005 | Last modified: Jul 31, 2005 |