Zonker
 Guru
 Joined: 18/08/2012 Location: United StatesPosts: 767 |
Posted: 06:15pm 06 Aug 2016 |
Copy link to clipboard |
 Print this post |
|
Humm... I did look up the code... From 8/22/15... It's not "up to date" with latest GUI firmware, but could work as a starting point fot the "tab" objects...
' LTC2983 Test Program for MM+470 on the GC microboard 2
Option explicit
' Assign Object Values
Const status_button=1
Const data_button=2
Const setup_button=3
Const cht1_led=4
Const cht2_led=5
Const cht3_led=6
Const cht4_led=7
Const egt1_led=8
Const egt2_led=9
Const egt3_led=10
Const egt4_led=11
Const temps_stat_frame=12
Const cht_stat_box=13
Const egt_stat_box=14
Const cht_data_frame=15
Const cht1_data_box=16
Const cht2_data_box=17
Const cht3_data_box=18
Const cht4_data_box=19
Const egt_data_frame=20
Const egt1_data_box=21
Const egt2_data_box=22
Const egt3_data_box=23
Const egt4_data_box=24
Const cht_thermo_type_frame=25
Const cht_jtype_button=26
Const cht_ktype_button=27
Const egt_thermo_type_frame=28
Const egt_jtype_button=29
Const egt_ktype_button=30
Const rpm_count_frame=31
Const rpm_dev2_button=32
Const rpm_even_button=33
Const rpm_mul2_button=34
Const rpm_mul4_button=35
Const rpm_dis_button=36
Const function_enable_frame=37
Const bt_radio_checkbox=38
Const rs485_checkbox=39
Const next_button=40
Const done_button=41
Dim screen_state=status_button ' current screen #, set to 1
Dim old_screen_state,touch_state,old_touch_state ' last screen #, returned object # touched
Font #5,1 ' mid sized bold
CLS
' Create "TAB" buttons
GUI button next_button,"Next",0,0,MM.FontWidth*7,MM.FontHeight*2,RGB(yellow),RGB(gray)
GUI button done_button,"Done",127,0,MM.FontWidth*5,MM.FontHeight*2,RGB(yellow),RGB(gray)
GUI hide next_button, done_button
GUI button status_button,"Status",0,0,MM.FontWidth*7,MM.FontHeight*2,RGB(yellow),RGB(gray)
GUI button data_button,"Data",127,0,MM.FontWidth*5,MM.FontHeight*2,RGB(yellow),RGB(gray)
GUI button setup_button,"Setup",220,0,MM.FontWidth*6,MM.FontHeight*2,RGB(yellow),RGB(gray)
' Create "Status Screen"
GUI frame temps_stat_frame,"Temps",0,75,320,125,RGB(yellow)
GUI displaybox cht_stat_box,7,100,MM.FontWidth*19,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(cht_stat_box)="CHT 1 2 3 4"
GUI led cht1_led,139,104,20,RGB(green)
GUI led cht2_led,188,104,20,RGB(red)
GUI led cht3_led,237,104,20,RGB(yellow)
GUI led cht4_led,285,104,20,RGB(yellow)
GUI displaybox egt_stat_box,7,150,MM.FontWidth*19,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(egt_stat_box)="EGT 1 2 3 4"
GUI led egt1_led,139,154,20,RGB(green)
GUI led egt2_led,188,154,20,RGB(green)
GUI led egt3_led,237,154,20,RGB(green)
GUI led egt4_led,285,154,20,RGB(green)
GUI hide temps_stat_frame,cht_stat_box,egt_stat_box
GUI hide cht1_led,cht2_led,cht3_led,cht4_led
GUI hide egt1_led,egt2_led,egt3_led,egt4_led
' Create "Data" Screen
GUI frame cht_data_frame," CHT ",0,75,110,159,RGB(yellow)
GUI displaybox cht1_data_box,15,90,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(cht1_data_box)="xxx"
GUI displaybox cht2_data_box,15,125,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(cht2_data_box)="xxx"
GUI displaybox cht3_data_box,15,160,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(cht3_data_box)="xxx"
GUI displaybox cht4_data_box,15,195,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(cht4_data_box)="xxx"
GUI frame egt_data_frame," EGT ",115,75,110,159,RGB(yellow)
GUI displaybox egt1_data_box,130,90,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(egt1_data_box)="xxxx"
GUI displaybox egt2_data_box,130,125,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(egt2_data_box)="xxxx"
GUI displaybox egt3_data_box,130,160,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(egt3_data_box)="xxxx"
GUI displaybox egt4_data_box,130,195,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(egt4_data_box)="xxxx"
GUI hide cht_data_frame,egt_data_frame
GUI hide cht1_data_box,cht2_data_box,cht3_data_box,cht4_data_box
GUI hide egt1_data_box,egt2_data_box,egt3_data_box,egt4_data_box
' Create "Settup" Screen
GUI frame cht_thermo_type_frame,"CHT",0,75,80,70,RGB(yellow)
GUI radio cht_jtype_button,"J",15,85,25,RGB(green)
GUI radio cht_ktype_button,"K",15,115,25,RGB(green)
CtrlVal(cht_jtype_button)=1
GUI frame egt_thermo_type_frame,"EGT",0,165,80,70,RGB(yellow)
GUI radio egt_jtype_button,"J",15,175,25,RGB(green)
GUI radio egt_ktype_button,"K",15,205,25,RGB(green)
CtrlVal(egt_jtype_button)=1
GUI frame rpm_count_frame,"RPM",185,75,115,160,RGB(yellow)
GUI radio rpm_dev2_button,"\2",200,105,25,RGB(green)
GUI radio rpm_even_button,"EV",200,135,25,RGB(green)
GUI radio rpm_mul2_button,"x2",200,165,25,RGB(green)
GUI radio rpm_mul4_button,"x4",200,175,25,RGB(green)
GUI radio rpm_dis_button,"DS",200,205,25,RGB(green)
CtrlVal(rpm_dis_button)=1
GUI hide cht_jtype_button,cht_ktype_button
GUI hide cht_thermo_type_frame
GUI hide egt_jtype_button,egt_ktype_button
GUI hide egt_thermo_type_frame
GUI hide rpm_dev2_button,rpm_even_button
GUI hide rpm_mul2_button,rpm_mul4_button,rpm_dis_button
GUI hide rpm_count_frame
'End
' set some values...
CtrlVal(cht1_led)=1
CtrlVal(cht2_led)=1
CtrlVal(cht3_led)=1
CtrlVal(cht4_led)=1
CtrlVal(egt2_led)=1
GUI interrupt TouchDown,TouchUp
'SetTick 1000,blink
' ----------- Main
Do
If screen_state<>old_screen_state Then redraw
If touch_state<>old_touch_state Then
Print "Touch "; touch_state; " Screen "; screen_state
Print "EGT Setup ";
If CtrlVal(egt_jtype_button) Then Print "J ";
If CtrlVal(egt_ktype_button) Then Print "K ";
Print " CHT Setup ";
If CtrlVal(cht_jtype_button) Then Print "J ";
If CtrlVal(cht_ktype_button) Then Print "K ";
old_touch_state=touch_state
Print ""
EndIf
Loop
' -------- Sub's
Sub blink
If CtrlVal(cht1_led) Then
CtrlVal(cht1_led)=0
CtrlVal(egt1_led)=1
Else
CtrlVal(cht1_led)=1
CtrlVal(egt1_led)=0
EndIf
End Sub
Sub TouchDown
'touch_state=Touch(ref)
'If touch_state>=1 And touch_state<=3 Then screen_state=touch_state
'Print touch_state screen_state
'If screen_state<>old_screen_state Then redraw
End Sub
Sub TouchUp
touch_state=Touch(lastref)
If touch_state>=1 And touch_state<=3 Then screen_state=touch_state
'Print touch_state screen_state
'If screen_state<>old_screen_state Then redraw
End Sub
Sub redraw
Select Case screen_state ' find out which control was touched
Case status_button ' restore status screen
GUI hide status_button
RBox 0,0,MM.FontWidth*7,MM.FontHeight*2,3,RGB(yellow),RGB(yellow)
Text 10,12,"Status",L,5,1,RGB(black),RGB(yellow)
If old_screen_state=data_button Then ' hide data screen objects
GUI restore data_button
GUI hide cht1_data_box,cht2_data_box,cht3_data_box,cht4_data_box
GUI hide egt1_data_box,egt2_data_box,egt3_data_box,egt4_data_box
GUI hide cht_data_frame,egt_data_frame
EndIf
If old_screen_state=setup_button Then ' hide setup screen objects
GUI restore setup_button
GUI hide cht_jtype_button,cht_ktype_button
GUI hide cht_thermo_type_frame
GUI hide egt_jtype_button,egt_ktype_button
GUI hide egt_thermo_type_frame
GUI hide rpm_dev2_button,rpm_even_button
GUI hide rpm_mul2_button ',rpm_mul4_button ',rpm_dis_button
GUI hide rpm_count_frame
EndIf
GUI restore temps_stat_frame,cht_stat_box,egt_stat_box
GUI restore cht1_led,cht2_led,cht3_led,cht4_led
GUI restore egt1_led,egt2_led,egt3_led,egt4_led
Case data_button ' restore data screen
GUI hide data_button
RBox 127,0,MM.FontWidth*5,MM.FontHeight*2,3,RGB(yellow),RGB(yellow)
Text 137,12,"Data",L,5,1,RGB(black),RGB(yellow)
If old_screen_state=status_button Then ' hide status screen objects
GUI restore status_button
GUI hide cht1_led,cht2_led,cht3_led,cht4_led
GUI hide egt1_led,egt2_led,egt3_led,egt4_led
GUI hide cht_stat_box,egt_stat_box
GUI hide temps_stat_frame
EndIf
If old_screen_state=setup_button Then ' hide setup screen objects
GUI restore setup_button
GUI hide cht_jtype_button,cht_ktype_button
GUI hide cht_thermo_type_frame
GUI hide egt_jtype_button,egt_ktype_button
GUI hide egt_thermo_type_frame
GUI hide rpm_dev2_button,rpm_even_button
GUI hide rpm_mul2_button ',rpm_mul4_button ',rpm_dis_button
GUI hide rpm_count_frame
EndIf
GUI restore cht_data_frame
GUI restore cht1_data_box,cht2_data_box,cht3_data_box,cht4_data_box
GUI restore egt_data_frame
GUI restore egt1_data_box,egt2_data_box,egt3_data_box,egt4_data_box
Case setup_button ' restore setup screen
GUI hide setup_button
RBox 220,0,MM.FontWidth*6,MM.FontHeight*2,3,RGB(yellow),RGB(yellow)
Text 230,12,"Setup",L,5,1,RGB(black),RGB(yellow)
If old_screen_state=data_button Then ' hide data screen objects
GUI restore data_button
GUI hide cht1_data_box,cht2_data_box,cht3_data_box,cht4_data_box
GUI hide cht_data_frame
GUI hide egt1_data_box,egt2_data_box,egt3_data_box,egt4_data_box
GUI hide egt_data_frame
EndIf
If old_screen_state=status_button Then ' hide status screen objects
GUI restore status_button
GUI hide cht1_led,cht2_led,cht3_led,cht4_led
GUI hide cht_stat_box
GUI hide egt1_led,egt2_led,egt3_led,egt4_led
GUI hide egt_stat_box
GUI hide temps_stat_frame
EndIf
GUI restore cht_thermo_type_frame
GUI restore cht_jtype_button,cht_ktype_button
GUI restore egt_thermo_type_frame
GUI restore egt_jtype_button,egt_ktype_button
GUI restore rpm_count_frame,rpm_dev2_button,rpm_even_button
GUI restore rpm_mul2_button ',rpm_mul4_button ',rpm_dis_button
End Select
old_screen_state=screen_state ' update old
End Sub
End
Use the basic tabbed framework and "touch action" sections, Insert your objects for the main sections of the screen and see how your screens work...
Post them back here so we can take a look..! |