![]() | Programming Guide | WideStudio/MWT Index Table of contents |
Æ®¸® ¸®½ºÆ®
¸Þ¼µå¿¡ÀÇÇÑ ¸®½ºÆ®ÀÇ µ¥ÀÌÅÍ Ç¥½Ã Á¦¾î
Æ®¸® ¸®½ºÆ®(WSCtreeList) ¶Ç´Â WSClist ÀÇ ¸®½ºÆ®Á¾º°À» Æ®¸® ¸®½ºÆ®¿¡ ¼³Á¤ÇѰͿ¡ Ç׸ñ Ç¥½Ã µ¥ÀÌÅ͸¦ Ãß°¡Çϱ⿡´Â ¸®½ºÆ®ÀÇ °æ¿ì¿Í ¸¶Âù°¡Áö·Î addItem ¸Þ¼µå¸¦ »ç¿ëÇÕ´Ï´Ù. addItem ¿¡ÀÇÇÏ¿© Ãß°¡ÇÒ ¹®ÀÚ¿, Ãß°¡µÉ À§Ä¡¸£ ÁöÁ¤ÇÕ´Ï´Ù. Ãß°¡ À§Ä¡¸¦ »ý·«ÇÏ¸é ¸®½ºÆ®ÀÇ ¸»¹Ì¿¡ Ãß°¡µË´Ï´Ù. ¶ÇÇÑ ¸®½ºÆ® Ç׸ñ¿¡ ³»Æ÷°èÃþÀº setItemValue ¸Þ¼µå·Î ¼³Á¤ÇÒ¼ö°¡ ÀÖ½À´Ï´Ù. Àμö¿¡´Â ¼³Á¤ÇÒ Ç׸ñÀÇ À§Ä¡, °ªÁ¾º°¿¡ WS_INDENT_LEVEL, ±×¸®°í °èÃþÀ» ÁöÁ¤ÇÕ´Ï´Ù. ¾Æ¹«°Íµµ ¼³Á¤¾ÈÇÑ °æ¿ì¿¡´Â Á¦0°èÃþÀ¸·ÎµÇ¿© ÃÖ»óÀÌÀÇ »óŰ¡ µË´Ï´Ù.$obj->setItemValue($pos,$mwt::WS_INDENT_LEVEL,$level); $pos = 0,1,2,...,-1(ÃÖÈĺñ) $level = 0(top),1,2,3...±×¸²°ú °°ÀÌ Æ®¸® ¸®½ºÆ®¿¡ Ç׸ñÀ» Ãß°¡ÇÒ »ùÇÃÀÔ´Ï´Ù.
[ Æ®¸® ¸®½ºÆ®]#---------------------------------------------------------- #Function for the event procedure #---------------------------------------------------------- use mwt; sub btnep1 { my ($object) = @_; # ¸®½ºÆ®ÀÇ Ç׸ñÀ» ¸ðµÎ »èÁ¦. $newlist_001->delAll(); # ¸®½ºÆ®ÀÇ ¸»¹Ì¿¡ Ç׸ñÀ» Ãß°¡. $newlist_001->addItem("item1"); $newlist_001->setItemValue(-1,$mwt::WS_INDENT_LEVEL,0); $newlist_001->addItem("item2"); $newlist_001->setItemValue(-1,$mwt::WS_INDENT_LEVEL,1); $newlist_001->addItem("item3"); $newlist_001->setItemValue(-1,$mwt::WS_INDENT_LEVEL,2); $newlist_001->addItem("item4"); $newlist_001->setItemValue(-1,$mwt::WS_INDENT_LEVEL,3); $newlist_001->addItem("item5"); $newlist_001->setItemValue(-1,$mwt::WS_INDENT_LEVEL,0); $newlist_001->addItem("item6"); $newlist_001->setItemValue(-1,$mwt::WS_INDENT_LEVEL,1); # ¸®½ºÆ®¸¦ º¯°æÇÑ °æ¿ì ¸¶Áö¸·¿¡ Çѹø °»½Å. $newlist_001->updateList(); return; } 1;Æ®¸® ¸®½ºÆ®ÀÇ À̿뿡 ÀÖ¾î¼ ÁÖÀÇÇÒ Á¡Àº Ç׸ñ¸¶´Ù¿¡´Â ºÎ¸ð°ú°èó·³ Ưº°ÇÑ °ü°è°¡ ¾Æ¹« ¾øÀÌ, ´Ü ¸®½ºÆ® Ç¥½Ã¿¡ ´ëÇØ¼ °¢ Ç׸ñÀÌ µé¿©¾²±â¸¦ ÁöÁ¤µÈ »óÅ·Πǥ½ÃµÈ´Ù°í ÇÕ´Ï´Ù. µû¶ó¼ ÃÖ»óÀÌÀÇ Ç׸ñÀ» »èÁ¦Çß´Ù°íÇÏ¿© ÀÌÈÄÀÇ °èÃþÀÇ Ç׸ñÀÌ ¾ø¼Áö´Â±â ¾Æ´Õ´Ï´Ù. ¶Ç Àü Ç׸ñ°úÀÇ µé¿©¾²±âÀÇ Â÷´Â +1 ±îÁö ÀÔ´Ï´Ù. +1 ÀÌ»ó Â÷°¡ÀÖ´Â °æ¿ì´Â ÀÚµ¿ÀûÀ¸·Î +1 ·Î µÇµµ·Ï º¸Á¤µÇ±â¿¡ ÁÖÀÇ ÇϽʽÿÀ.¼Ó¼º¿¡¼ÀÇ Æ®¸® ¸®½ºÆ® µ¥ÀÌÅÍÀÇ ¼³Á¤
ºñ±³Àû Ç׸ñ¼ö°¡ ÀûÀº °æ¿ì, ¼Ó¼º¿¡¼ Çѽÿ¡ Ç׸ñÀ» ¼³Á¤ÇÒ¼ö°¡ ÀÖ½À´Ï´Ù. ÀÌ °æ¿ì, ¿ì¼± "dataSource" ¼Ó¼ºÀ» WS_DATA_SOURCE_NONE ¿¡ ÁöÁ¤ÇÕ´Ï´Ù. ´ÙÀ½¿¡ "data" ¼Ó¼º¿¡ ¾Æ·¡¿¡ Ç¥½ÃÇϴºÁ¿Í °°Àº ¼½ÄÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù.
µ¥ÀÌÅͼ½Ä : (¼Ó¼º "useIcon" °¡ True ÀÎ °æ¿ì)icon_filename,indent_level,1=open/0=close, °¡ ¸ñ ¹®ÀÚ¿\n...µ¥ÀÌÅͼ½Ä : (¼Ó¼º "useIcon" °¡ False ÀÎ °æ¿ì)indent_level,1=open/0=close, Ç׸ñ ¹®ÀÚ¿\n...¾ÆÀÌÄÜ ÁöÁ¤¿¡ À־ ¾ÆÀÌÄÜÀ» »ý·«ÇÑ °æ¿ì, ¼Ó¼º "iconPixmap" ·Î ÁöÁ¤ÇÑ ¾ÆÀÌÄÜÀÌ ÀÌ¿ëµË´Ï´Ù.#---------------------------------------------------------- #Function for the event procedure #---------------------------------------------------------- use mwt; sub btnep1 { my ($object) = @_; # ¸®½ºÆ®ÀÇ Ç׸ñÀ» ¸ðµÎ »èÁ¦. $newlist_001->delAll(); # ¸®½ºÆ®¿¡ ¼Ó¼ºÀ» °æÀ¯ÇÏ¿© µ¥ÀÌÅ͸¦ ¼³Á¤ $newlist_001->setProperty("dataSource",$mwt::WS_DATA_SOURCE_NONE); $newlist_001->setProperty("data",",0,1,item1\n,1,1,item2\n,2,1,item3"); return; } 1;ÆÄÀÏ¿¡¼ÀÇ Æ®¸® ¸®½ºÆ® µ¥ÀÌÅÍÀÇ ¼³Á¤
ÆÄÀϸíÀ» ÁöÁ¤Çؼ ÆÄÀÏ¿¡¼ Çѽÿ¡ Ç׸ñÀ» ¼³Á¤ ÇÒ¼ö ÀÖ½À´Ï´Ù. ÀÌ °æ¿ì ¿ì¼± "dataSource" ¼Ó¼ºÀ» WS_DATA_SOURCE_FILE ¿¡ ÁöÁ¤ÇÕ´Ï´Ù. ´ÙÀ½¿¡ "dataSourceName" ¼Ó¼º¿¡ ÆÄÀϸíÀ» ÁöÁ¤ÇÕ´Ï´Ù. ºô´õ¿¡¼ÀÇ ¼Ó¼º ¼³Á¤,ÇÁ·Î±×·¥¿¡¼ÀÇ ¼³Á¤À¸·Î µ¿ÀÛÇÕ´Ï´Ù. ¾Æ·¡´Â ÇÁ·Î±×·¥¿¡¼ÀÇ ¼³Á¤¿¹ÀÔ´Ï´Ù.#---------------------------------------------------------- #Function for the event procedure #---------------------------------------------------------- use mwt; sub btnep1 { my ($object) = @_; # ¸®½ºÆ®ÀÇ Ç׸ñÀ» ¸ðµÎ »èÁ¦. $newlist_001->delAll(); # ¸®½ºÆ®¿¡ ÆÄÀÏÀ» °æÀ¯Çؼ µ¥ÀÌÅ͸¦ ¼³Á¤ $newlist_001->setProperty("dataSource",$mwt::WS_DATA_SOURCE_FILE); $newlist_001->setProperty("dataSourceName","data.txt"); return; } 1; #data.txt ÀÇ ³»¿ë $(WSDIR)/sys/pixmaps/bi16.xpm,0,1,item1 1,1,item2 2,1,item3 3,1,item4 $(WSDIR)/sys/pixmaps/bi16.xpm,0,1,item5 1,1,item6 2,1,item7 3,1,item8ÀνºÅϽº¿¡¼ÀÇ Æ®¸® ¸®½ºÆ®ÀÇ µ¥ÀÌÅÍ Ç¥½Ã
ÀνºÅϽº¸íÀ» ÁöÁ¤Çؼ ÀνºÅϽº¿¡¼ Çѽÿ¡ Ç׸ñÀ» ¼³Á¤ÇÒ¼ö°¡ ÀÖ½À´Ï´Ù. ÀÌ °æ¿ì ¿ì¼± "dataSource" ¼Ó¼ºÀ» WS_DATA_SOURCE_INSTANCE ¿¡ ÁöÁ¤ÇÕ³ª´Ù. ´ÙÀ½¿¡ "dataSourceName" ¼Ó¼º¿¡ ÀνºÅϽº¸íÀ» ÁöÁ¤ÇÕ´Ï´Ù. ¾Æ·¡ÀÇ ¿¹¼´Â WSCtextField ÀÇ ÀνºÅϽº newtext_000 ¸¦ ÁöÁ¤ÇϰíÀÖ½À´Ï´Ù. µ¥ÀÌÅÍÀÇ Çü½ÄÀº ÆÄÀÏ ÁöÁ¤ÀÇ °æ¿ì¿Í °°½À´Ï´Ù. newtext_000 ¿¡ ÀԷµǿ©ÀÖ´Â ¹®ÀÚ¿ÀÌ ¸®½ºÆ®¿¡ Ç¥½ÃµË´Ï´Ù. ºô´õ¿¡¼ÀÇ ¼Ó¼º ¼³Á¤,ÇÁ·Î±×·¥¿¡¼ÀÇ ¼³Á¤À¸·Î µ¿ÀÛÇÕ´Ï´Ù. ¾Æ·¡´Â ÇÁ·Î±×·¥¿¡¼ÀÇ ¼³Á¤¿¹ÀÔ´Ï´Ù. ÀÌ °æ¿ì, ÀÔ·Â ÇʵåÀÇ ÀνºÅϽº newtext_000 ¿¡ ÀԷµǿ©ÀÖ´Â ¹®ÀÚ¿ÀÌ Æ®¸® ¸®½ºÆ®ÀÇ Ç׸ñÀ¸·Î Ç¥½ÃµË´Ï´Ù.#---------------------------------------------------------- #Function for the event procedure #---------------------------------------------------------- use mwt; sub btnep1 { my ($object) = @_; # ¸®½ºÆ®ÀÇ Ç׸ñÀ» ¸ðµÎ »èÁ¦. $newlist_001->delAll(); # ¸®½ºÆ®¿¡ ÆÄÀÏÀ» °æÀ¯Çؼ µ¥ÀÌÅ͸¦ ¼³Á¤ $newlist_001->setProperty("dataSource",$mwt::WS_DATA_SOURCE_INSTANCE); $newlist_001->setProperty("dataSourceName","newtext_000"); return; } 1;
Copyright(C) WideStudio/MWT Development Team, 1999-2005 | Last modified: Jul 31, 2005 |