oldpapa49
17-10-2012, 22:01
Hey guys, thanks for getting back..
This where I'm at now..
I have got a box to display in the console. I would rather display in a UI panel area since there can be a few boxes representing a button.
The console displays the box with the name on top as the code says (I can not find the color chart examples). It only 1 box in the console so far.
When I depress first time it changes color, I sleep it before I change the color of it for not pressed.
For the life of me, I can not find or figure away to do this through the UI. I made a nice display but the Do/Loop kills it..
I need the Do/Loop to scan the serial port for the codes.
Basically I want to press a button and display the action on the screen. I hate to do it via console, looks so DOS :).
There are 14 TSO type, so I will need to add a file to be read after the type has been selected. Petr, if you recall the other program that has serial selection.. be that + the TSO type. BTW, that program is still in use and works great.
I do not know if there is another way of sniffing the serial port for the codes from the Arduino, but I'm always open for suggestions.
I'm attaching the code, it is a little of this and a little of that!
Wayne
' TMI TSO Test Program
' Program by W Little and Others
' 10/18/2012 rev . 01
' This program works with Arduino UNO and SparkFun CAN BUS Shield
' It will read via the USB as serial and Displays Button/Joystick action
'
' Needs:
' Read serial and decode data and light/display correct BOX location as ON and turn off. TBD
' current test TSO is 9896-001-80971
' need to creat away to select TSO and set box/button field.
' This program currently hardcoded for just 1 TSO as a learning tool
' Look here : for rev updates and feature additions:
'
' Currently working routine with RS232 support
' Screen info available to user
' This Program would not be possible if it
' where not the HELP from thinBasic Forum
' www.community.thinbasic.com GURU's
' Petr Schreiber, Eros Olmi,
' LionHeart008, Michael Clease and many
' other hero's behind the screen!
' Kudo's to them ALL!
' W Little wlfredl@yahoo.com
'
'--------------------------------------------
'
'--------------------------------------------
USES "UI"
Uses "CONSOLE"
USES "COMM"
Dim hDLG As DWord
'---------------------------------
Dim reList(20) As DWord
'--------------------------------- G
Dim hSaveDlg As DWord '16 O
DIM hReseDlg AS DWORD '17 O
DIM hUpDlg AS DWORD '18 D
DIM hDnDlg AS DWORD '19 !
DIM hLeftDlg AS DWORD '20
DIM hRightDlg AS DWORD '21 commcode ref
'---------------------------------
' I Know, Time to Clean Soon!
Dim display As String
Dim Chn As String
Dim Msg As String
DIM wparam,lparam as DWORD
DIM Win1Params as DWORD VALUE = %WS_POPUP or %WS_VISIBLE or %WS_CLIPCHILDREN or %WS_CAPTION or %WS_SYSMENU or %WS_MINIMIZEBOX or _
%WS_THICKFRAME
DIM n as LONG
DIM lResult as LONG
Dim errornumber As Long '
'DIM cbctl as DWORD '
Dim hComm As Long
DIM funct as String
DIM data as String
Dim nBytes As Long
DIM DECI as DWORD
DIM ModemData as DWORD
Dim value2 As String
Dim value3 As DWord
dim CountAtiB as DWORD
Dim CountATI As Long
Dim sBuffer As String
Dim MaxComm As DWord = 15'Change me to increase vList
DIM vList(MaxComm) AS String
dim ID_List01 as long
dim MaxItems as long
dim CurItem as long
DIM tmpStr AS STRING
dim tmpLong as long
' RS232 stuff
DIM commport AS String ' Select from main menu
DIM COMMDATA AS Dword ' 0 to 255 dec. Input from arrow or up down buttons
DIM commcode as dword ' 0 to 15, 40 (64 hex), 41 (65 hex) to rs232
DIM commcodeOLD as DWORD
DIM txtstr as String
DIM commstrOLD as String
DIM commstr as String
DIM commprint as String
DIM Counter AS LONG = 1'---Counter to count output lines
' code sent to rs232 for adj should be commcode, commdata
BEGIN CONST
'----------------------------------------
%Text01
%List01
%Butt01
%ID_HELP_LABEL
%CtrlRes
%MsgText
%HelpText
%helpText2
%CtrlRes2
%ButtonClose = 1001
END CONST
' New Code
' DIM vList(MaxElements) AS STRING (Only Supporting 4 Com Ports
' If you want more Com ports, change MaxElements DIM statement
vList(1) = "Com1"
vList(2) = "Com2"
vList(3) = "Com3"
vList(4) = "Com4"
vList(5) = "Com5"
vList(6) = "Com6"
vList(7) = "Com7"
vList(8) = "Com8"
commport = "Com1"
commcode = "-1"
' commdata = 127 'midrange start
commstr = "NO Function Selected"
'chn = 0 'US displays
hComm = COMM_FreeFile
COMM_Open("COM4", hComm)
COMM_Set(hComm, %COMM_BAUD, 115200)
'COMM_Set(hComm, %COMM_PARITY, 0)
'COMM_Set(hComm, %COMM_BYTE, 8)
'COMM_Set(hComm, %COMM_STOP, 0)
'COMM_Set(hComm, %COMM_RTSFLOW, 0)
'Console_WriteLine("Opening COM" & " as hComm=" & hComm)
' Count = 2
Console_WriteLine Chr$(13)
Function TBMain( ) As Long
Dialog New 0, "Philips TSO Test Program 9896-001-80971 (Rv .01)", -1, -1, 560, 300, Win1Params, 0 To hDlg
Control Add Label, hDlg, %HelpText,"Selected Commport is 4", 3, 1, 150, 12
Control Add Textbox , hDlg, %CtrlRes, commdata, 129, 250, 30, 15, Win1Params
'---Set window minimum size
Dialog Set Minsize hDlg, 560,320
Control Add Button, hDlg, %ButtonClose, "Click to kill", 90, 50, 150, 100
Dialog Show Modal hDlg, Call cbDialog
End Function
CallBack Function cbDialog () As Long
'Select Case CBMSG
' Case %WM_COMMAND
'If CBWPARAM = %ButtonClose Then Dialog End CBHNDL
' Case %WM_DESTROY
' MsgBox 0, "Window is to be destroyed."
' End Select
'End Function
Do
' ' For count = 2 To 4
' Sleep 100 ' delay for modem to respond
nBytes = COMM_Get(hComm, %COMM_RXQUE)
COMM_Recv(hComm, nBytes, sBuffer)
' value2 = sBuffer
' ' Count = count + 1
value2 = LEFT$(sBuffer, nBytes)
If Asc(value2) = -1 Then Loop 'need this to skip no data
If Asc(value2) >1 Then Call displayBox
value3 = DIGIT$(value2)
' Console_WriteLine (nBytes)
' Console_WriteLine (value3)
' Console_WriteLine(value2)
Loop
End Function
'---Show dialog in modal mode
'---cbDialog function is the callback function handling dialog events
'---Application control will pass to dialog callback till dialog will exists
'Dialog Show Modal hDlg' , Call cbDialog
'---If execution comes here it means main dialog as been destroyed
' PRINTL "---Application finished. Press a key to end---"
'WAITKEY
' Callback procedure for main window
'------------------------------------------------------------------------------
CallBack Function displayBox( ) As Long
If value3 = 0430015600 Then Call ImageGrab
If value3 = 1606592704 Then Console_WriteLine "Detector size -"
If value3 = 1606032704 Then Console_WriteLine "Detector size +"
If value3 = 0420015600 Then Console_WriteLine "Beam size"
If value3 = 2345309936 Then Console_WriteLine "FluoFlavor 1"
If value3 = 2355309936 Then Console_WriteLine "FluoFlavor 2"
If value3 = 2365309936 Then Console_WriteLine "FluoFlavor 3"
If value3 = 0490015600 Then Console_WriteLine "Reset buzzer"
If value3 = 4140015600 Then Console_WriteLine "Wedge follow"
Sleep 100
End Function
CallBack Function ImageGrab( ) As Long
Console_Box(60, 5, 10, 5, 24, 00, "Image Grab", 15, %CONSOLE_BOX_FLAG_3DON)
Sleep 1000
Console_Box(60, 5, 10, 5, 17, 24, " ", 15, %CONSOLE_BOX_FLAG_3DOFF)
End Function
'You Have Reach the Bottom, there is no other place to go other than UP!
Petr Schreiber
19-10-2012, 09:12
Hi,
I tried to change the do/loop to timer, as Mike suggested and added the select case and shutdown using button:
' TMI TSO Test Program
' Program by W Little and Others
' 10/18/2012 rev . 01
' This program works with Arduino UNO and SparkFun CAN BUS Shield
' It will read via the USB as serial and Displays Button/Joystick action
'
' Needs:
' Read serial and decode data and light/display correct BOX location as ON and turn off. TBD
' current test TSO is 9896-001-80971
' need to creat away to select TSO and set box/button field.
' This program currently hardcoded for just 1 TSO as a learning tool
' Look here : for rev updates and feature additions:
'
' Currently working routine with RS232 support
' Screen info available to user
' This Program would not be possible if it
' where not the HELP from thinBasic Forum
' www.community.thinbasic.com GURU's
' Petr Schreiber, Eros Olmi,
' LionHeart008, Michael Clease and many
' other hero's behind the screen!
' Kudo's to them ALL!
' W Little wlfredl@yahoo.com
'
'--------------------------------------------
'
'--------------------------------------------
Uses "UI"
Uses "CONSOLE"
Uses "COMM"
Dim hDLG As DWord
'---------------------------------
Dim reList(20) As DWord
'--------------------------------- G
Dim hSaveDlg As DWord '16 O
Dim hReseDlg As DWord '17 O
Dim hUpDlg As DWord '18 D
Dim hDnDlg As DWord '19 !
Dim hLeftDlg As DWord '20
Dim hRightDlg As DWord '21 commcode ref
'---------------------------------
' I Know, Time to Clean Soon!
Dim display As String
Dim Chn As String
Dim Msg As String
Dim wparam,lparam As DWord
Dim Win1Params As DWord Value = %WS_POPUP Or %WS_VISIBLE Or %WS_CLIPCHILDREN Or %WS_CAPTION Or %WS_SYSMENU Or %WS_MINIMIZEBOX Or _
%WS_THICKFRAME
Dim n As Long
Dim lResult As Long
Dim errornumber As Long '
'DIM cbctl as DWORD '
Dim hComm As Long
Dim funct As String
Dim data As String
Dim nBytes As Long
Dim DECI As DWord
Dim ModemData As DWord
Dim value2 As String
Dim value3 As DWord
Dim CountAtiB As DWord
Dim CountATI As Long
Dim sBuffer As String
Dim MaxComm As DWord = 15'Change me to increase vList
Dim vList(MaxComm) As String
Dim ID_List01 As Long
Dim MaxItems As Long
Dim CurItem As Long
Dim tmpStr As String
Dim tmpLong As Long
' RS232 stuff
Dim commport As String ' Select from main menu
Dim COMMDATA As DWord ' 0 to 255 dec. Input from arrow or up down buttons
Dim commcode As DWord ' 0 to 15, 40 (64 hex), 41 (65 hex) to rs232
Dim commcodeOLD As DWord
Dim txtstr As String
Dim commstrOLD As String
Dim commstr As String
Dim commprint As String
Dim Counter As Long = 1'---Counter to count output lines
' code sent to rs232 for adj should be commcode, commdata
Begin ControlID
'----------------------------------------
%Text01
%List01
%Butt01
%ID_HELP_LABEL
%CtrlRes
%MsgText
%HelpText
%helpText2
%CtrlRes2
%ButtonClose
%mainTimer
End ControlID
' New Code
' If you want more Com ports, change MaxElements DIM statement
Long i
For i = 1 To UBound(vList)
vList(i) = "Com" + Format$(i)
Next
commport = "Com1"
commcode = "-1"
' commdata = 127 'midrange start
commstr = "NO Function Selected"
'chn = 0 'US displays
hComm = COMM_FreeFile
COMM_Open("COM4", hComm)
COMM_Set(hComm, %COMM_BAUD, 115200)
'COMM_Set(hComm, %COMM_PARITY, 0)
'COMM_Set(hComm, %COMM_BYTE, 8)
'COMM_Set(hComm, %COMM_STOP, 0)
'COMM_Set(hComm, %COMM_RTSFLOW, 0)
'Console_WriteLine("Opening COM" & " as hComm=" & hComm)
' Count = 2
Console_WriteLine Chr$(13)
Function TBMain( ) As Long
Dialog New 0, "Philips TSO Test Program 9896-001-80971 (Rv .01)", -1, -1, 560, 300, Win1Params, 0 To hDlg
Control Add Label, hDlg, %HelpText,"Selected Commport is 4", 3, 1, 150, 12
Control Add Textbox , hDlg, %CtrlRes, commdata, 129, 250, 30, 15, Win1Params
Control Add Button, hDlg, %ButtonClose, "Click to kill", 90, 50, 150, 100
'---Set window minimum size
Dialog Set Minsize hDlg, 560,320
Dialog Show Modal hDlg, Call cbDialog
End Function
CallBack Function cbDialog () As Long
Select Case CBMSG
' -- When program starts, we start timer
Case %WM_INITDIALOG
Dialog Set Timer CBHNDL, %mainTimer, 1
' -- Handling button press
Case %WM_COMMAND
If CBCTL = %ButtonClose And CBCTLMSG = %BN_CLICKED Then
Dialog End CBHNDL
End If
' -- Once timer ticks
Case %WM_TIMER
If CBCTL = %mainTimer Then
nBytes = COMM_Get(hComm, %COMM_RXQUE)
COMM_Recv(hComm, nBytes, sBuffer)
value2 = LEFT$(sBuffer, nBytes)
If Asc(value2) = -1 Then Exit Function
If Asc(value2) > 1 Then Call displayBox
End If
' -- Shutdown of the timer
Case %WM_DESTROY
Dialog Kill Timer CBHNDL, %mainTimer
End Select
End Function
' Procedure for handling value3
'------------------------------------------------------------------------------
Function displayBox( ) As Long
Select Case value3
Case 0430015600
Call ImageGrab
Case 1606592704
Console_WriteLine "Detector size -"
Case 1606032704
Console_WriteLine "Detector size +"
Case 0420015600
Console_WriteLine "Beam size"
Case 2345309936
Console_WriteLine "FluoFlavor 1"
Case 2355309936
Console_WriteLine "FluoFlavor 2"
Case 2365309936
Console_WriteLine "FluoFlavor 3"
Case 0490015600
Console_WriteLine "Reset buzzer"
Case 4140015600
Console_WriteLine "Wedge follow"
End Select
Sleep 100
End Function
Function ImageGrab( ) As Long
Console_Box(60, 5, 10, 5, 24, 00, "Image Grab", 15, %CONSOLE_BOX_FLAG_3DON)
Sleep 1000
Console_Box(60, 5, 10, 5, 17, 24, " ", 15, %CONSOLE_BOX_FLAG_3DOFF)
End Function
'You Have Reach the Bottom, there is no other place to go other than UP!
Petr
oldpapa49
19-10-2012, 21:59
Ok, all, here is the near never to be done test of 1 TSO model...
I wonder if I will make a file to load in the 14 different models and make a screen up from the file?
Or will I just make 13 more ThinBasic programs...
Time will tell..
Mr. Clease, I have your timer rem out, will mess with it later..
Petr, your like me, for got the value3= line... All test in the case failed, I found it..
And here is the code.. and it works great.. cpu time near 0
And I got rid of most of the waste code so far.. and I played with the buttons as well.. I think it is a nice layout
' Empty GUI script created on 10-19-2012 07:19:11 by (ThinAIR)
' TMI TSO Test Program
' Program by W Little and Others
' 10/19/2012 rev . 04
' This program works with Arduino UNO and SparkFun CAN BUS Shield
' It will read via the USB as serial and Displays Button/Joystick action
'
' Needs:
' Read serial and decode data and light/display correct BOX location as ON and turn off. TBD
' current test TSO is 9896-001-80971
' need to creat away to select TSO and set box/button field.
' This program currently hardcoded for just 1 TSO as a learning tool
' Look here : for rev updates and feature additions:
'
' Currently working routine with RS232 support
' Screen info available to user
' This Program would not be possible if it
' where not the HELP from thinBasic Forum
' www.community.thinbasic.com GURU's
' Petr Schreiber, Eros Olmi,
' LionHeart008, Michael Clease and many
' other hero's behind the screen!
' Kudo's to them ALL!
' W Little wlfredl@yahoo.com
'
'--------------------------------------------
'
'--------------------------------------------
Uses "UI"
'Uses "CONSOLE"
Uses "COMM"
Dim hDLG As DWord
'---------------------------------
Dim reList(20) As DWord
'--------------------------------- G
' I Know, Time to Clean Soon!
Dim Win1Params As DWord Value = %WS_POPUP Or %WS_VISIBLE Or %WS_CLIPCHILDREN Or %WS_CAPTION Or %WS_SYSMENU Or %WS_MINIMIZEBOX Or _
%WS_THICKFRAME Or %DS_3DLOOK
Dim hComm As Long
Dim nBytes As Long
Dim value2 As String
Dim value3 As DWord
Dim sBuffer As String
Dim MaxComm As DWord = 15'Change me to increase vList
Dim vList(MaxComm) As String
' RS232 stuff
Dim commport As String ' Select from main menu
Dim COMMDATA As DWord ' 0 to 255 dec. Input from arrow or up down buttons
Dim commcode As DWord ' 0 to 15, 40 (64 hex), 41 (65 hex) to rs232
Dim commstr As String
' code sent to rs232 for adj should be commcode, commdata
Begin ControlID
%ID_Button_00 'Brightness
%ID_Button_01 'Detector Size -
%ID_Button_02 'Detector Size +
%ID_Button_03 'Fluoflavor 1
%ID_Button_04 'Fluoflavor 2
%ID_Button_05 'Fluoflavor 3
%ID_Button_06 'Image Grab
%ID_Button_07 'Not Used
%ID_Button_08 'Not Used
%ID_Button_09 'Buzzer Reset
%ID_Button_10 'Beam Size
%ID_Button_11 'Right Wedge
%ID_Button_12 'Shutters UP
%ID_Button_13 'Shutters Dn
%ID_Button_14 'Shutters Lft
%ID_Button_15 'Shutters Rt
%ID_Button_16 'Shutters Clik
%ID_Button_17 'Rt wedge Lft
%ID_Button_18 'Rt wedge Rt
%ID_Button_19 'Rt Wedge CW
%ID_Button_20 'Rt Wedge CCW
%ID_Button_21 'Rt Wedge Clik
%ID_BUTTON_22 'Reserve
'----------------------------------------
%Text01
%List01
%Butt01
%ID_HELP_LABEL
%CtrlRes
%MsgText
%HelpText
%helpText2
%CtrlRes2
%ButtonClose
%IDC_TIMER
%mainTimer
End ControlID
' New Code
' If you want more Com ports, change MaxElements DIM statement
Long i
For i = 1 To UBound(vList)
vList(i) = "Com" + Format$(i)
Next
commport = "Com4"
commcode = "-1"
' commdata = 127 'midrange start
commstr = "NO Function Selected"
hComm = COMM_FreeFile
COMM_Open(commport, hComm)
COMM_Set(hComm, %COMM_BAUD, 115200)
Function TBMain( ) As Long
Dialog New 0, "Philips TSO Test Program 9896-001-80971 (Rv .04)", -1, -1, 560, 300, Win1Params, 0 To hDlg
'Control Add Label, hDlg, %HelpText,"Selected Commport is ", commport, 3, 1, 150, 12
'Control Add Textbox , hDlg, %CtrlRes, commdata, 129, 250, 30, 15, Win1Params
Control Add Button hDlg, %ButtonClose, "Click to kill", 0, 0, 40, 25, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Add Button hDlg, %ID_Button_01, "Detector Size -" , 140, 40, 40, 25, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_01
Control Add Label hDlg, %ID_Button_00, "________________________________________________________________________________________________________________________ ",_
0, 145, 580, 15, %SS_CENTER
Control Add Button hDlg, %ID_Button_02, "Detector Size +" , 200, 40, 40, 25, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_02
Control Add Button hDlg, %ID_Button_03, "Fluoflavor 1" , 380, 40, 40, 25, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_03
Control Add Button hDlg, %ID_Button_04, "Fluoflavor 2" , 440, 40, 40, 25, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_04
Control Add Button hDlg, %ID_Button_05, "Fluoflavor 3" , 500, 40, 40, 25, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_05
Control Add Button, hDlg, %ID_Button_06, "Image Grab" , 20, 80, 40, 25,%BS_CENTER| %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_06
Control Add Button, hDlg, %ID_Button_07, "Not Used" , 140, 80, 40, 25,%BS_CENTER| %WS_TABSTOP | %BS_DEFAULT |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_07
Control Add Button, hDlg, %ID_Button_08, "Not Used" , 200, 80, 40, 25,%BS_CENTER| %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_08
Control Add Button, hDlg, %ID_Button_09, "Reset Buzzer" , 500, 80, 40, 25,%BS_CENTER| %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_09
Control Add Button, hDlg, %ID_Button_10, "Beam Size" , 80, 120, 40, 25,%BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_10
Control Add Button, hDlg, %ID_Button_11, "Wedge follow" , 440, 120, 40, 25,%BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_11
Control Add Button, hDlg, %ID_Button_12, "Shutters Up" , 80, 160, 40, 25, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_12
Control Add Button, hDlg, %ID_Button_13, "Shutters Down" , 80, 220, 40, 25, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_13
Control Add Button, hDlg, %ID_Button_14, "Shutters Left" , 40, 190, 40, 25, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_14
Control Add Button, hDlg, %ID_Button_15, "Shutters Right" , 120, 190, 40, 25, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_15
Control Add Button, hDlg, %ID_Button_16, "Shutters Clik" , 82, 190, 35, 25, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_16
Control Add Button, hDlg, %ID_Button_17, "Right wedge left" , 400, 160, 40, 35, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_17
Control Add Button, hDlg, %ID_Button_18, "Right wedge right" , 480, 160, 40, 35, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_18
Control Add Button, hDlg, %ID_Button_19, "Right wedge CW" , 405, 210, 35, 55, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_19
Control Add Button, hDlg, %ID_Button_20, "Right wedge CCW" , 480, 210, 35, 55, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_20
Control Add Button, hDlg, %ID_Button_21, "Right wedge Clik" , 445, 180, 30, 35, %BS_CENTER | %WS_TABSTOP | %BS_MULTILINE |%WS_DLGFRAME
Control Disable hDlg, %ID_Button_21
'---Set window minimum size
Dialog Set Minsize hDlg, 560,320
Dialog Show Modal hDlg, Call cbDialog
End Function
CallBack Function cbDialog () As Long
Select Case CBMSG
' -- When program starts, we start timer
Case %WM_INITDIALOG
Dialog Set Timer CBHNDL, %mainTimer, 1
' -- Handling button press
Case %WM_COMMAND
If CBCTL = %ButtonClose And CBCTLMSG = %BN_CLICKED Then
Dialog End CBHNDL
End If
' Case %WM_TIMER
' If CBWPARAM = %IDC_TIMER Then
' Dialog Kill Timer CBHNDL, %IDC_TIMER
' GetComports(CBHNDL)
' GetFirmware(CBHNDL)
' nBytes = COMM_Get(hComm, %COMM_RXQUE)
' COMM_Recv(hComm, nBytes, sBuffer)
' value2 = LEFT$(sBuffer, nBytes)
' value3 =DIGIT$(value2)
' If Asc(value2) = -1 Then Exit Function
' If Asc(value2) > 1 Then Call displayBox
' Dialog Set Timer CBHNDL, %IDC_TIMER, %TIMER_DELAY
'EndIf
' -- Once timer ticks
Case %WM_TIMER
If CBCTL = %mainTimer Then
nBytes = COMM_Get(hComm, %COMM_RXQUE)
COMM_Recv(hComm, nBytes, sBuffer)
value2 = LEFT$(sBuffer, nBytes)
value3 =DIGIT$(value2)
If Asc(value2) = -1 Then Exit Function
If Asc(value2) > 1 Then Call displayBox
End If
' -- Shutdown of the timer
Case %WM_DESTROY
Dialog Kill Timer CBHNDL, %mainTimer
End Select
End Function
' Procedure for handling value3
'------------------------------------------------------------------------------
Function displayBox( ) As Long
Select Case value3
Case 0430015600
Control Enable hDlg, %ID_Button_06
Sleep 500
Control Disable hDlg, %ID_Button_06
Case 1606592704
Control Enable hDlg, %ID_Button_01
Sleep 500
Control Disable hDlg, %ID_Button_01
Case 1606032704
Control Enable hDlg, %ID_Button_02
Sleep 500
Control Disable hDlg, %ID_Button_02
Case 0420015600
Control Enable hDlg, %ID_Button_10
Sleep 500
Control Disable hDlg, %ID_Button_10
Case 2345309936
Control Enable hDlg, %ID_Button_03
Sleep 500
Control Disable hDlg, %ID_Button_03
Case 2355309936
Control Enable hDlg, %ID_Button_04
Sleep 500
Control Disable hDlg, %ID_Button_04
Case 2365309936
Control Enable hDlg, %ID_Button_05
Sleep 500
Control Disable hDlg, %ID_Button_05
Case 0490015600
Control Enable hDlg, %ID_Button_09
Sleep 500
Control Disable hDlg, %ID_Button_09
Case 4140015600
Control Enable hDlg, %ID_Button_11
Sleep 500
Control Disable hDlg, %ID_Button_11
Case 0450015600
Control Enable hDlg, %ID_Button_07
Sleep 500
Control Disable hDlg, %ID_Button_07
Case 4110015600
Control Enable hDlg, %ID_Button_08
Sleep 500
Control Disable hDlg, %ID_Button_08
'JoySticks below here
Case 210165408
Control Enable hDlg, %ID_Button_12
Sleep 500
Control Disable hDlg, %ID_Button_12
Case 210221408
Control Enable hDlg, %ID_Button_13
Sleep 500
Control Disable hDlg, %ID_Button_13
Case 211625408
Control Enable hDlg, %ID_Button_14
Sleep 500
Control Disable hDlg, %ID_Button_14
Case 211065408
Control Enable hDlg, %ID_Button_15
Sleep 500
Control Disable hDlg, %ID_Button_15
Case 88000000
Control Enable hDlg, %ID_Button_16
Sleep 500
Control Disable hDlg, %ID_Button_16
Case 2417312192
Control Enable hDlg, %ID_Button_17
Sleep 500
Control Disable hDlg, %ID_Button_17
Case 2416752192
Control Enable hDlg, %ID_Button_18
Sleep 500
Control Disable hDlg, %ID_Button_18
Case 2415753192
Control Enable hDlg, %ID_Button_19
Sleep 500
Control Disable hDlg, %ID_Button_19
Case 2415753752
Control Enable hDlg, %ID_Button_20
Sleep 500
Control Disable hDlg, %ID_Button_20
Case 1012000000
Control Enable hDlg, %ID_Button_21
Sleep 500
Control Disable hDlg, %ID_Button_21
'Case 4110015600
' Control Enable hDlg, %ID_Button_08
' Sleep 500
' Control Disable hDlg, %ID_Button_08
End Select
End Function
'You Have Reach the Bottom, there is no other place to go other than UP!
Thanks a bunch for the help, and again, I'm sure I'm not done
Wayne