/*=========================================================== * CCT_test.iwb * Custom Control Tutorial Testing File * PART 09 * Copyright (c)T.L. McCaughn 2011 * This file may be freely shared *============================================================*/ AUTODEFINE "OFF" /* I always use this - personal preference */ $MAIN /* Reguired for this develpoment project not required when making single example file */ $include "windowssdk.inc" /* I always use this - personal preference */ /*----------------SECTION 1---------------------------------- This section contains declarations that will be converted into an include file that User's will use in there applications with the following line: $INCLUDE "myControl.inc" ------------------------------------------------------------*/ '$USE "myControl.lib /* uncomment when converted to include file */ DECLARE EXTERN CreateGageRLM(win as WINDOW,l as INT,t as INT,d as INT,id as UINT ) DECLARE EXTERN ConfigGageRLM(win as WINDOW,style as int,title as string,u as string,rawmin as int,rawmax as int,dialmin as int,dialmax as int,sf as int,id as UINT ) DECLARE EXTERN SetGagePanelColorRLM(win as WINDOW,id as UINT,pnlcolor as UINT) DECLARE EXTERN SetGageDialDarkRLM(win as WINDOW,id as UINT,state as INT) DECLARE EXTERN SetGagePos1RLM(win as WINDOW,id as UINT,pos as INT) DECLARE EXTERN SetGagePos2RLM(win as WINDOW,id as UINT,pos as INT) const ROUND270B = 1 const ROUND270T = 2 const ROUND270L = 3 const ROUND270R = 4 const ROUND360SGL = 5 const ROUND360DBL = 6 const ROUNDCLOCK12 = 7 const ROUNDCLOCK24 = 8 const ROUND2PENV = 9 const ROUND2PENH = 10 const GNMLDOWN = 0x501 const GNMLUP = 0x502 const GNMRDOWN = 0x503 const GNMRUP = 0x504 /*=============== END OF SECTION 1 =========================*/ /*----------------SECTION 2--------------------------------- This section contains declarations needed for the test program and the converted example along with any needed initialization -------------------------------------------------------------*/ window main int run /*=============== END OF SECTION 2 ===========================*/ /*----------------SECTION 3----------------------------------- This section creates our test/example parent window and its associated parts --------------------------------------------------------------*/ openwindow main, 0, 0, 880, 780, @CAPTION|@SYSMENU, 0, "Gage Demo", &mainHandler BEGINMENU main MENUTITLE "&File" MENUITEM "Quit", 0, 100 ENDMENU /*=============== END OF SECTION 3 ================================*/ /*----------------SECTION 4--------------------------------------- This section is where we create one or more instances of our control. ------------------------------------------------------------------*/ CreateGageRLM(main,10,30,200,1 ) CreateGageRLM(main,220,30,200,2 ) CreateGageRLM(main,430,30,200,3 ) CreateGageRLM(main,640,30,200,4 ) CreateGageRLM(main,10,270,200,5 ) CreateGageRLM(main,220,270,200,6 ) CreateGageRLM(main,430,270,200,7 ) CreateGageRLM(main,640,270,200,8 ) CreateGageRLM(main,10,510,200,9 ) CreateGageRLM(main,220,510,200,10 ) /*=============== END OF SECTION 4 =================================*/ /*----------------SECTION 5----------------------------------------- This section is where we configure each instance of our control. --------------------------------------------------------------------*/ ConfigGageRLM(main,ROUND270B,"Fuel Qty","lbs.",0,100,0,10,1000,1) ConfigGageRLM(main,ROUND270T,"Oil Temp","degF",0,100,0,15,20,2) ConfigGageRLM(main,ROUND270L,"Inlet Flow","gpm",0,100,0,8,100,3 ) ConfigGageRLM(main,ROUND270R,"Fuel Flow","gpm",0,100,0,5,0, 4 ) ConfigGageRLM(main,ROUND360SGL,"Fuel Qty","lbs.",0,10,0,0,1000, 5 ) ConfigGageRLM(main,ROUND360DBL,"Inlet Flow","gpm",0,10,0,0,100, 6 ) ConfigGageRLM(main,ROUND2PENV,"Battery","amps",0,100,-2,13,10, 7 ) ConfigGageRLM(main,ROUND2PENH,"Manifold Press",chr$(34)+"Hg",0,100,0,5,0, 8 ) ConfigGageRLM(main,ROUNDCLOCK12,"Local","",0,0,0,0,0, 9 ) ConfigGageRLM(main,ROUNDCLOCK24,"Local","",0,0,0,0,0, 10 ) /*=============== END OF SECTION 5 =================================*/ /*----------------SECTION 6----------------------------------------- This section sets the timer which will update our controls. ---------------------------------------------------------------------*/ STARTTIMER main, 200, 42 run = 1 /*=============== END OF SECTION 6 ===================================*/ /*----------------SECTION 7-------------------------------------------- This section is the idle loop for our test/example program. -----------------------------------------------------------------------*/ WAITUNTIL run = 0 /*=============== END OF SECTION 7 ====================================*/ /*----------------SECTION 8-------------------------------------------- This section is where we do any cleanup and close our test/example program -----------------------------------------------------------------------*/ STOPTIMER main, 42 CLOSEWINDOW main END /*=============== END OF SECTION 8 =====================================*/ /*----------------SECTION 9--------------------------------------------- This section contains the message handler for our test/example program.. -------------------------------------------------------------------------*/ SUB mainHandler(),INT SELECT @MESSAGE CASE @IDCREATE centerwindow main CASE @IDCLOSEWINDOW run = 0 CASE @IDCONTROL SELECT @CONTROLID CASE 1 CASE& 2 CASE& 3 CASE& 4 CASE& 5 CASE& 6 CASE& 7 CASE& 8 CASE& 9 CASE& 10 SELECT @NOTIFYCODE CASE GNMLUP SetGagePanelColorRLM(main,@CONTROLID,RGB(255,255,255)) CASE GNMLDOWN SetGagePanelColorRLM(main,@CONTROLID,RGB(255,0,0)) CASE GNMRDOWN SetGageDialDarkRLM(main,@CONTROLID,1) CASE GNMRUP SetGageDialDarkRLM(main,@CONTROLID,0) ENDSELECT ENDSELECT CASE @IDTIMER SELECT @CODE CASE 42 static int rawvalue = 0 int tickmin = 0,tickmax = 100 static int toggle = 0 select toggle case 0 rawvalue++ if rawvalue > tickmax rawvalue = tickmax toggle=1 endif case 1 rawvalue-- if rawvalue < tickmin rawvalue = tickmin toggle=0 endif endselect SetGagePos1RLM(main,1,rawvalue) 'ROUND270B SetGagePos1RLM(main,2,rawvalue) 'ROUND270T SetGagePos1RLM(main,3,rawvalue) 'ROUND270L SetGagePos1RLM(main,4,rawvalue) 'ROUND270R SetGagePos1RLM(main,5,rawvalue) 'ROUND360SGL SetGagePos1RLM(main,6,rawvalue) 'ROUND360DBL SetGagePos1RLM(main,7,rawvalue) 'ROUND2PENV SetGagePos2RLM(main,7,rawvalue) 'ROUND2PENV SetGagePos1RLM(main,8,rawvalue) 'ROUND2PENH SetGagePos2RLM(main,8,rawvalue) 'ROUND2PENH SetGagePos1RLM(main,9,0) 'ROUNDCLOCK12 SetGagePos1RLM(main,10,0) 'ROUNDCLOCK24 ENDSELECT CASE @IDMENUPICK SELECT @MENUNUM CASE 100 run = 0 ENDSELECT ENDSELECT RETURN 0 ENDSUB /*=============== END OF SECTION 9 =====================================*/