Dear Developers,
I would like change the text "realtime" into "normaltime". How can I do that in PB. Can you explean it in SDK and DDT code. I working with FF3
I have this code from VB.
IF(Command4.Caption = "REALTIME" THEN
Command4.Caption = "NORMALTIME"
ELSE
Command4.Caption = "REALTIME"
END IF
Can somebody help me how I can do this for FF3 SDK code
Hi Stephane, try this:
If FF_Control_GetText( HWND_FORM1_COMMAND1 ) = "REALTIME" Then
FF_Control_SetText( HWND_FORM1_COMMAND1, "NORMALTIME" )
Else
FF_Control_SetText( HWND_FORM1_COMMAND1, "REALTIME" )
End If
Quote from: Marc van Cauwenberghe on September 22, 2013, 09:46:02 AM
Hi Stephane, try this:
If FF_Control_GetText( HWND_FORM1_COMMAND1 ) = "REALTIME" Then
FF_Control_SetText( HWND_FORM1_COMMAND1, "NORMALTIME" )
Else
FF_Control_SetText( HWND_FORM1_COMMAND1, "REALTIME" )
End If
Marc,
Thanks,
I have an other problem with test the TimerID from an Timer
This is the VB60 code
Private Sub Command2_Click()
If Timer2.Enabled = False Then 'test timer stopped?
txtReceiveData.Text = "" 'empty the textbox
Timer2.Enabled = True 'set the timer
Else
txtReceiveData.Text = "timer off" ' set the textbox with contents
Timer2.Enabled = False ' stop the timer
End If
End Sub
I try this in FF3
Function FORM1_BTNRECEIVECODE_BN_CLICKED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idButtonControl As Long _ ' identifier of button
) As Long
LOCAL TimerID AS DWORD
IF(ISFALSE(TimerID)) THEN
SetTimer(HWND_FORM1, IDC_FORM1_TIMER2, 1, 0)
FF_Control_SetText(HWND_FORM1_TXTRECEIVEDATA,"")
ELSE
KillTimer(HWND_FORM1, IDC_FORM1_TIMER2)
FF_Control_SetText(HWND_FORM1_TXTRECEIVEDATA,"Timer Off")
END IF
It does not work why?
Quote from: Stephane Fonteyne on September 22, 2013, 10:55:33 AM
Function FORM1_BTNRECEIVECODE_BN_CLICKED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idButtonControl As Long _ ' identifier of button
) As Long
IF IsWindow(HWND_FORM1_TIMER2) = 0 THEN
HWND_FORM1_TIMER2 = SetTimer(HWND_FORM1, IDC_FORM1_TIMER2, 1, 0) ' 1 millisecond timer
FF_Control_SetText(HWND_FORM1_TXTRECEIVEDATA,"")
ELSE
KillTimer(HWND_FORM1, IDC_FORM1_TIMER2)
FF_Control_SetText(HWND_FORM1_TXTRECEIVEDATA,"Timer Off")
END IF
:'(
This is probably a better code than the one I posted earlier:
Function FORM1_BTNRECEIVECODE_BN_CLICKED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idButtonControl As Long _ ' identifier of button
) As Long
IF HWND_FORM1_TIMER2 = 0 THEN
HWND_FORM1_TIMER2 = SetTimer(HWND_FORM1, IDC_FORM1_TIMER2, 1, 0) ' 1 millisecond timer
FF_Control_SetText(HWND_FORM1_TXTRECEIVEDATA,"")
ELSE
KillTimer(HWND_FORM1, IDC_FORM1_TIMER2)
HWND_FORM1_TIMER2 = 0
FF_Control_SetText(HWND_FORM1_TXTRECEIVEDATA,"Timer Off")
END IF
By the way, when the new FireFly object syntax is introduced (per http://www.planetsquires.com/protect/forum/index.php?topic=3354.0) then you will be able to start and stop Timers and set the Interval very easily.
' Start the Timer
Form1.Timer1.Enabled = %TRUE
' Stop the Timer
Form1.Timer1.Enabled = %FALSE
' Change the Timer's delay and then start the timer
Form1.Timer1.Interval = 5000 ' 5 seconds
Form1.Timer1.Enabled = %TRUE
The above code already works in the new FireFly object framework so keep an eye out for when this new feature gets uploaded into the next FireFly update.
A nice new feature of the new object syntax is that you will be able to tell a Timer not to fire via the WM_CREATE handler just by setting the Enabled property to FALSE. The way that FireFly worked previous to this is that the Timer(s) would always start once the Form was shown. You had to use some hacks to prevent that from happening if you did not want the Timer to fire as soon as the Form loaded.
QuoteYou had to use some hacks to prevent that from happening if you did not want the Timer to fire as soon as the Form loaded.
An 'Enable' option on the timer's properties page would have solved this (in hindsight).
David