サーバーモジュール処理中のイメージやカーソルの変更方法

World WideのLANSA技術フォーラムに投稿されたトピックと、日本のお客様からのお問い合わせへの回答の中から、皆様にお役に立つLANSAの開発テクニックやトラブルシュートに関する情報をご紹介します。

質問

サーバーモジュール処理中にイメージやカーソルを処理中の表示に変更することはできますか?

回答

以下のサンプルでは、サーバーモジュールの処理中にWebページのイメージとカーソルを変更しています。
ボタン「同期」はサーバーモジュールを同期実行、ボタン「非同期」はサーバーモジュールを非同期実行します。

処理中の画像は、#SYS_WEB.LoadingImageを使い、Webページの「設定」→「画面のロード」に指定している画像を使用することも可能です。
#Image1.Image <= #SYS_WEB.LoadingImage

Webページ サンプル:

Begin_Com Role(*EXTENDS #PRIM_WEB) Height(121) Width(377)

Define_Com Class(#PRIM_VS.Style) Name(#Style1) Cursor(Wait)
Define_Com Class(#PRIM_IMAG) Name(#Image1) Displayposition(1) Left(0) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Height(41) Width(52) Image(#xImageStop64)

Define_Com Class(#PRIM_PHBN) Name(#Button1) Displayposition(2) Left(52) Parent(#COM_OWNER) Tabposition(2) Top(18) Caption('同期’) Width(110)
Define_Com Class(#PRIM_PHBN) Name(#Button2) Displayposition(3) Left(167) Parent(#COM_OWNER) Tabposition(3) Top(18) Width(110) Caption('非同期’)

Define_Com Class(#PRIM_TIMR) Name(#Timer1) Startup(Manual) Interval(1)

Evtroutine Handling(#Button1.Click)
#Image1.Image <= #xImagePlay64
#COM_OWNER.Style <= #Style1
#Timer1.Start
Endroutine

Evtroutine Handling(#Timer1.Tick)
Define_Com Class(#LJSELECT.FindAll) Name(#FindAll)
#Timer1.Stop
#FindAll.Execute
#Image1.Image <= #xImageStop64
#COM_OWNER.Style <= *NULL
Endroutine

Evtroutine Handling(#Button2.Click)
#COM_OWNER.Processing
Endroutine

Mthroutine Name(Processing)
Define_Com Class(#LJSELECT.FindAll) Name(#FindAll)
#Image1.Image <= #xImagePlay64
#COM_OWNER.Style <= #Style1
#FindAll.ExecuteAsync
Evtroutine Handling(#FindAll.Completed)
#Image1.Image <= #xImageStop64
#COM_OWNER.Style <= *NULL
Endroutine
Endroutine

End_Com

サーバーモジュール サンプル LJSELECT:

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_SRVM)

Def_List Name(#DEPTABList) Fields(#DEPTMENT #DEPTDESC) Counter(#ListCount) Type(*WORKING) Entrys(*MAX)

Srvroutine Name(FindAll)
List_Map For(*OUTPUT) List(#DEPTABList)
Begin_Loop To(1000)
Select Fields(#DEPTABList) From_File(DEPTAB)
Add_Entry To_List(#DEPTABList)
Endselect
End_Loop
Endroutine

End_Com

有償の「LANSAテクニカル・ホットライン・サービス」をご契約いただければ、データベースの検索(https://demo.lansa.jp/qadb/)」から、今回、ご紹介した以外の技術情報も探すことが出来ます。 「LANSAテクニカル・ホットライン・サービス」のご契約についてはお問い合わせフォーム(https://www.lansa.jp/inquiryforms/)よりお問い合わせください。