Software Development for Control Panels rooms for Windows Tablet – Form

Home Automation eHouse .

Create the main form (layout of the tablet screen .

Placed on the main Form 24 fields TPanel panels for all types of digital outputs RM .

These will form the buttons to turn out RoomManager (or electrical) .

In addition, the color will depend on the state of the read out .

For this reason we used the standard buttons or similar type TButton , because they do not have the possibility to change the color .

We call them ” outputX ” where X is the number of output .

I do not need to be deployed , because it will do it automatically, this application . For each button, the output must be assigned to the same event (onClick) – output1Click .

Placed on the main Form 24 fields TPanel type panels for all programs to run RM .

These will form the buttons for switching the current RoomManager (ie, on / off electrical devices of the group with a change in the measuring inputs of the thresholds used for regulating such . temperature) .

We call them ” programX ” where X is the number of the button.

Similarly, no need to deploy , because it will do it automatically, this application .

For each button, the program should be assigned to the same event (onClick) – program1Click .

On the main form of text labels are 16 types TLabel to display all the results of measurements of RoomManager (numbered Label1 to Label16) .

Similarly as in the above cases do not need to deploy .

View the final form for the
 form to create room control panel

Initialization of the form:

// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /

procedure TForm1.FormCreate (Sender: TObject) ;

var alignx,buttonindex,row,column,k,i:integer ;

begin

GetComputerName; // Get the name of computer or panel – reads the

path:=getcurrentdir(); // Get the current local path application directory – reads the directory in which the program

path:=stringreplace(path,’\Bin’,’\’,[Rfignorecase]); // Get path of application eHouse

remotepath:=path;// The same path for remote access for initialization – at the beginning of the path mapped for the same remote access

loadnames_rm;// Load controller names ehouse1

init_heat_temperature_names;// Init heatmanager names

readethernetdevs;// Load controllers ethernet eHouse names

i:=1 ;

while i <=Paramcount to // perform command line argument – processes the command line

begin

if pos(‘/X:’,lowercase(ParamStr(i)))=1 then // panel width – width of the panel

form1.Width:=chk_int(stringreplace(ParamStr(i),’/X:’ , ‘ ‘ , [Rfignorecase]));

if pos(‘/S:’ , lowercase(ParamStr(i)))=1 then // panel height – height of the panel

form1.height:=chk_int(stringreplace(ParamStr(i),’/S:’,’ ‘, [Rfignorecase])) ;

if pos(‘/R:’,lowercase(ParamStr(i)))=1 then // device name(RoomManager) – RoomManger name

deviceindex:=RMDeviceIndexByName((stringreplace(ParamStr(i),’/R:’,’ ‘ , [Rfignorecase]))) ;

if pos ( ‘/A:’, lowercase(ParamStr (i)))=1 then // device address (RoomManager) – RoomManager address

deviceindex: = (get_index_rm(stringreplace(ParamStr(i) , ‘/ A:’ , ‘ ‘ , [Rfignorecase]))) ;

if pos ( ‘/P:’ , lowercase(ParamStr(i)))=1 then // remote access path – remote access path

remotepath:=((stringreplace (ParamStr(i) , ‘/P:’ , ‘ ‘ , [Rfignorecase]))) ;

inc(i) ;

end ;

if form1.width<100 then form1.width: = 800; / / If wrong parameters for size sets default – defaults

if form1.height<100 then form1.height: = 600 ;

devicestoupdatestatus: = IntToStr(rm[deviceindex].Adrha) + ‘-‘ + IntToStr(rm[deviceindex].adrl) ;

// Limit searching for current status RoomManager / filter out other devices

// Check for single device pannel for limitation UTILISATION

// Check only the status of the selected RoomManager times less CPU and server eHouse

outputbuttonnames(deviceindex) ; // Initialize buttons and labels names – boots, buttons and text labels

form1.caption:=’eHouse Control Panel:’ + Rm[deviceindex].devname; // Set caption of the main forms of RoomManager Name – header shows the name of the form RoomManager

timer1.Interval:=3000; // Set cyclic task interval in milliseconds

timer1.Enabled:=true; // Start automatic tasks (status update

k:=1;

buttonindex:=0;// Current button (visible) index – the current number of the (apparent)

row:=0;// Current button in row – number of the current key in the current line

//Column:=0;

alignx:=(form1.clientWidth-(Rows)*(buttonwidth+Xspace)) div 2;// Center buttons on panel – centering blocks buttons

for i:=0 to form1.ComponentCount-1 // Output button automatic setup – automatically configure the Exit button

begin // for each object on form1 – for all elements of the Form1

if (form1.Components[i] is TPanel) then // if the object is TPanel (our button) – if the object type TPanel (button)

begin

if comparetext((form1.components [i] as TPanel).name,’output’+IntToStr(k))=0 then / / if name CONSIST (output)

begin

row:=buttonindex mod (rows); / / Calculate rows and columns indexes – calculates the coordinates of the column and row

column:=buttonindex div (rows) ;

if length(OutputNames[k-1])>0 then // Only shows ouput buttons with the name – only shows buttons with the name

begin

(Form1.Components[i] as TPanel).left:=alignx+row*(buttonwidth+Xspace); // Calculate X axis position – calculates its position in the X axis

(Form1.Components[i] as TPanel).top:=yoffsetouts+column*(buttonheight+yspace); // Calculate the Y axis position – calculates its position in the Y axis

(Form1.Components[i] as TPanel).width:=buttonwidth; // Set Width Buttons – Width of the buttons

(Form1.Components[i] as TPanel).height:=buttonheight; // Set Buttons Height – The amount of buttons

(Form1.components[i] as TPanel).caption:=Outputnames[k-1]; // Set Button Caption – sets the button text

(Form1.components[i] as TPanel).Bevelinner:=bvRaised;

(Form1.components[i] as TPanel).BevelOuter:=bvRaised;

(Form1.components[i] as TPanel).font.Size:=fontsize; // Set Font Size Button – sets the font size for the button

inc(buttonindex); // Next button visible – see the next

end

else

begin

(Form1.components[i] as TPanel).visible:=false ; // No name = do not show button – remove keys without a name

end;

inc(k); / / Next button – next button

end;

end;

end;
//// / / / / / / / / The same buttons for program – Similarly for the buttons to launch programs

buttonindex:=0 ;

k:=1 ;

for i:=0 to form1.ComponentCount-1 to

begin

if (form1.Components[i] is TPanel) then

begin

if comparetext((form1.components[i] as TPanel).name,’program’+IntToStr(k)) = 0 then

begin

row:=buttonindex mod (rows);

column:=buttonindex div (rows);

if length(ProgramNames[k – 1])>0 then

begin

(Form1.Components[i] as TPanel).left:=alignx+row*(buttonwidth+Xspace);

(Form1.Components[i] as TPanel).top:=yoffsetprograms+column*(buttonheight+yspace);

(Form1.Components[i] as TPanel).width:=buttonwidth;

(Form1.Components[i] as TPanel).height:=buttonheight;

(Form1.components[i] as TPanel).caption:=Programnames[k-1]; // Set button caption buttons for program – sets the name of the program buttons

(Form1.components[i] as TPanel).Bevelinner:=bvRaised;

(Form1.components[i] as TPanel).BevelOuter:=bvRaised;

(Form1.components[i] as TPanel).font.Size:=fontsize;

inc(buttonindex);

end

else

begin

(Form1.components[i] as TPanel).visible:=false;

end;

inc(k);

end;

end;

end;

k:=1;

buttonindex:=0;

// Alignx:=(form1.clientWidth-(Labelrows*(labelwidth+labelresultsize+Xspace))) div 2 ;

// / / / / / Analogicaly for Labels – Similarly, the label

for i:=0 to form1.ComponentCount-1 to

begin

if (form1.Components[i] is TLabel) then

begin

if comparetext((form1.components[i] as TLabel).name,’label’+IntToStr(k))=0 then

begin

row:=buttonindex mod (labelrows);

column:=buttonindex div (labelrows);

if length(LabelNames[k – 1])>0 then // if length of label text> ; 0 – if the description is

begin

(Form1.Components[i] as TLabel).left:=alignx+row*(labelwidth+labelresultsize+Xspace) ; // Calculate X location

(Form1.Components[i] as TLabel).top:=yoffsetlabel+column*(labelheight+yspace); // Calculate the Y location

(Form1.Components[i] as TLabel).width:=labelwidth;

(Form1.Components[i] as TLabel).height:=labelheight;

(Form1.components[i] as TLabel).caption:=LabelNames[k-1]; // / Assign label captions – headers suitable labels

(Form1.components[i] as TLabel).font.color:=clwhite; // Set default color for label – sets the default color for labels

if pos(‘[-%]’,LabelNames[k – 1])>0 then (form1.components[i] as TLabel).font.color:=clyellow; // Set color for light measurement – for the measurement of color lighting

if pos(‘[%]’,LabelNames[k – 1])>0 then (form1.components[i] as TLabel).font.color:=Claque; // Set color measurement for percent – color for the value of interest

if pos(‘[C]’,LabelNames[k – 1])>0 then(form1.components[i] as TLabel).font.color:=clwhite; // Set color for temperature management – for color temperature values

(Form1.components[i] as TLabel).font.Size:=labelfontsize; // Set font size for label – sets the font size for the text label

inc(buttonindex); // Next visible label – label appears next

end

else

begin

(Form1.components[i] as TLabel).visible:=false; // Hide text labels without – hide labels without textu

end;

inc(k); // Next label – next label

end;

end;

end;

update_status; // Update panel for current device status from logs – updates the status of the driver of the log files from the server eHouse

end;

The end result after auto-configured and button placement by the program and remove untold elements (if you do not want them to have on the panel because of restrictions on the rights of access or use of the output).

 The final effect of the automatic distribution of elements on the Form

Read more: Home Automation – Controllers eHouse

Home Automation eHouse Home Automation Manufacturer