Thread Rating:
  • 244 Vote(s) - 2.65 Average
  • 1
  • 2
  • 3
  • 4
  • 5
画面の操作を無効にするには?
03-12-2014, 04:03 PM, (This post was last modified: 03-12-2014, 04:57 PM by alchimiste.)
#3
RE: 画面の操作を無効にするには?
umemuraさんのBarrierFrameを使って、新しいwith-busy-new-viewマクロを作ってみました。

with-busy-new-viewの呼び出しだけで、バリア効果が出ます。

Code:
{define-macro public
    {with-busy-new-view
        ?view:expression
     do
        ?body:verbatim
    }
    {return
        {expand-template
            || ?viewはGraphic客体に変更
            let g:Graphic = ?view

            || 追加されたコード
            ||  umemuraさんのBarrierFrameを利用
            let view:View = {g.get-view} asa View
            let b:#BarrierFrame
            {for child in view.ordered-children do
                {type-switch child
                 case t:BarrierFrame do
                    set b = t
                 else
                    set b = {BarrierFrame}
                    {b.add child}
                    {view.add b, replace?=true}
                }              
                {break}
            
            }
            
            
            def restore-proc = {disable-buttons view}
            
            {try
                {with b.barrier? = true do
                    {view.update}
                    ?body
                }
             finally
                {after 0s do
                    {restore-proc}
                    || FIXME:
                    || スキンコントロールで正しく再描画されない場合があるためのworkaround
                    {refresh-skin-drawing view}
                }
            }
        }
    }
}

次は使用の例です。より簡単なコードになりました。
Code:
{def ta = {TextArea
              width = {make-elastic},
              height= {make-elastic}
          }
}

{def cb =
    {CommandButton
        label= "with-busy-view",
        {on Action at c:CommandButton do
            
            {with-busy-new-view c do
                ||時間をかけるためのダミー処理
                def (buf:StringBuf, n:int, encoding:CharEncoding) =
                    {read-from {url "http://www.yahoo.com"}}
                set ta.value = {buf.to-String}
            }
            
        }
    }
}
{def box = {VBox hstretch? = true, ta, cb}}
{value box}
Reply


Messages In This Thread
RE: 画面の操作を無効にするには? - by alchimiste - 03-12-2014, 04:03 PM
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('1043')