workspace class Provides a MDI workspace object |
||||||||||||||||||||||
Inherits |
||||||||||||||||||||||
object widget | ||||||||||||||||||||||
Description |
||||||||||||||||||||||
This widget provides a workspace window that can contain decorated window. | ||||||||||||||||||||||
Functions |
||||||||||||||||||||||
|
||||||||||||||||||||||
Examples |
||||||||||||||||||||||
# Let's start. # We start the main class creation, in the constructor we do the # widget's showing, to give a particular popup # creation appearance. class (ws,widget) { constructor { $$->$setGeometry(%X,%Y,100,100) (KviKvsObjectFunctionCall *c $$->%label=$new(label,$$) $$->%label->$settext("Another class by N\&G") $$->%label->$setautoresize(1) $$->$show() } } # We create the new workspace, and we set a 640x480 size with widget $resize command %Workspace=$new(workspace) %Workspace->$resize(640,480) # Now we make a cycling construction of the widgets (look at the class), # and give to the widgets a random X and Y coordinates. # It takes few seconds to show the effects, be patient. %I=0 while (%I<100) %X=$rand(500) %Y=$rand(480) %Widget=$new(ws,%Workspace) %I++ } # Let's show the fireworks! EnJoY! %Workspace->$show() | ||||||||||||||||||||||
Example 2: | ||||||||||||||||||||||
# This is like the first example but it has a particular animation effect. %Hex[]=$array(0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) class (ws,widget) { constructor { $$->$setGeometry(%X,%Y,100,100) $$->%lay=$new(layout,$$) %i=0 while (%i<10) { $$->%label=$new(label,$$) $$->%label->$settext("Another class by N\&G") %color=%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)] $$->%label->$setforegroundcolor(%color) $$->%label->$setautoresize(1) $$->%lay->$addwidget($$->%label,%i,0) %i++; } $$->$show() } mousepressevent { if ($istimer(cycle) == 1) killtimer cycle } } %Workspace=$new(workspace) %Workspace->$resize(640,480) %Workspace->$setWindowTitle("Hit the mouse to stop cycling windows...") %I=0 %Cycle=1 while (%I<20) { %X=$rand(500) %Y=$rand(480) %Widget=$new(ws,%Workspace) %I++ } %Workspace->$show timer (cycle,3000) { if (%Cycle==1) %Workspace->$tile() if (%Cycle==2) { %Workspace->$cascade() %Cycle=1 return } %Cycle++ } privateimpl(%Workspace,mousepressevent) { if ($istimer(cycle) == 1) killtimer cycle } | ||||||||||||||||||||||