プログラム言語 FreeBasic |
GetGadgetState
Value = GetGadgetState(gadget)
Function GetGadgetState(ByVal gadget As long) As Integer
ガジェットの状況を取得できます:
Linux システムでは、ガジェット(OptionGadget、CheckBoxGadget)自体が、GetGadgetState を使って照会されるとすぐに、以前の状態を返すことができる場合があります。
X サーバーは情報をすぐに更新しないため、これは Linux および X サーバーイベントに固有です。
gadget - ガジェット番号
Windows , Linux
#Include "window9.bi"
Dim As HWND hwnd
Dim As integer event
hwnd=OpenWindow("1",300,10,350,150)
ButtonGadget(1,10,10,80,80,"ボタン", FB_BS_PUSHLIKE)
TextGadget(2,100,10,180,20)
Do
event=WaitEvent()
If event=EventClose Then End
If event=eventgadget Then
Var ss=GetGadgetState(1)
Select Case ss
Case 1
SetGadgetText(2,"ボタンが押されている")
Case 0
SetGadgetText(2,"ボタンが押されていない")
End Select
EndIf
Loop
#Include "window9.bi"
Dim As integer hwnd,event
hwnd=OpenWindow("1",300,10,350,150)
ButtonGadget(1,10,10,80,80,"ボタン", BS_PUSHLIKE Or BS_AUTOCHECKBOX )
TextGadget(2,100,10,180,20)
Do
event=WaitEvent()
If event=EventClose Then End
If event=eventgadget Then
Var ss=GetGadgetState(1)
Select Case ss
Case 1
SetGadgetText(2,"ボタンが押されている")
Case 0
SetGadgetText(2,"ボタンが押されていない")
End Select
EndIf
Loop