Log in

View Full Version : Forms- How to make/use



Frozenfire216
09-21-2012, 03:48 PM
Ok, so basically, in my code I define four variables:

SCREEN_X1,SCREEN_Y1,SCREEN_X2,SCREEN_Y2 as borders for FindDTM, etc.
Simba is on my jumpdrive, and I want to be able to switch computers easily.

Down where the variables are defined in the main loop, I have comments for the 4 main computers I use what the variables should be defined as for each computer, but each time I switch computers, I have to type these in.

Basically, I want to be able to run my script, and a form will pop up with a drop down menu with computer names, and when I select the computer name I want, and press OK, it defines what the the Screen Size variables should equal for that specific computer.

e.g Select computer: Home-Desktop <--(drop down menu here)
Home-Laptop
Laptop VM
John's Laptop.

So if I select Home Laptop, it sets
SCREEN_X1:=260;
SCREEN_Y1:=66;
SCREEN_X2:=1019;
SCREEN_Y2:=545;
and continues to run the rest of the code.

I am a complete noob to forms... I tried looking at the scar manual's form tutorial but I couldn't make sense of it.

This code is not for RS, so unfortunatly, no SMART.

Any help at all is appreciated! Thanks!

Brandon
09-21-2012, 07:11 PM
Ok, so basically, in my code I define four variables:

SCREEN_X1,SCREEN_Y1,SCREEN_X2,SCREEN_Y2 as borders for FindDTM, etc.
Simba is on my jumpdrive, and I want to be able to switch computers easily.

Down where the variables are defined in the main loop, I have comments for the 4 main computers I use what the variables should be defined as for each computer, but each time I switch computers, I have to type these in.

Basically, I want to be able to run my script, and a form will pop up with a drop down menu with computer names, and when I select the computer name I want, and press OK, it defines what the the Screen Size variables should equal for that specific computer.

e.g Select computer: Home-Desktop <--(drop down menu here)
Home-Laptop
Laptop VM
John's Laptop.

So if I select Home Laptop, it sets
SCREEN_X1:=260;
SCREEN_Y1:=66;
SCREEN_X2:=1019;
SCREEN_Y2:=545;
and continues to run the rest of the code.

I am a complete noob to forms... I tried looking at the scar manual's form tutorial but I couldn't make sense of it.

This code is not for RS, so unfortunatly, no SMART.

Any help at all is appreciated! Thanks!



const ComputerName = 'MyComputerName';

Procedure SetScreenSize(var X, Y, X2, Y2: Integer);
begin
Case LowerCase(ComputerName) Of
'mycomputer:
begin
X := 0; Y := 0; X2 := 800; Y2 := 600;
end;

'computer2:
begin
X := 0; Y := 0; X2 := 1024; Y2 := 768;
end;

'computer3:
begin
X := 0; Y := 0; X2 := 1366; Y2 := 768;
end;
end;
end;


Not sure if that's what you mean. If you want to detect target screensize dynamically then you need to do something similar but instead just do GetClientDimensions(Width, Height); Where width and height are variables that will hold the width and height of your computer screen.


P.S. All this crap written from the school browser so meh.. I haven't tested or compiled any of that.