SRL Archive - OSR Help

Form questions


Bad Boy JH

2011-01-17 20:04:56

Because I am now looking for work, I thought I would expand on a game project I did for school, which used SCAR, and create a fully working board game (think monopoly) with a fully functioning AI, (that challenge later). I have currently converted it to simba, and am configuring better code.

Q1. Forms have a TComboBox, where you can select an item, or type one in, is there one which you can only select one?

Q2. TLabel, can I change the orientation of the text? (ie have it going up the page).

Q3. When my form loads, its too big for my screen, (its 1200x1200) and its not offering a scroll bar. I tried using the property 'VERTSCROLLBAR' but when I try and use create, or change Visible, it just says Compiling failed, with no explanation.

Q4. Why won't WordWrap work propely…

possibly more questions later. Yes I know I need a small snippit of code from SRL to get forms to work, yes I know where it is. Yes you guys will get full credit for Simba and the stuff that makes forms work.

Dgby714

2011-01-17 20:38:45

From: Bad Boy JH

Q1. Forms have a TComboBox, where you can select an item, or type one in, is there one which you can only select one?


Use the OnKeyDown Event.

PascalScript := FAIL;

so we don't get the ReadOnly property…

program new;

procedure Pressed(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
DebugLn(IntToStr(Key));
if (not (InIntArray([8, 9, 13, 16, 17, 18, 37, 38, 39, 40, 46], Key))) then
Key := 0;

if ((Key = 8) or (Key = 46)) then
TComboBox(Sender).Text := '';
end;

procedure ShowForm;
var
I: integer;
begin
with TComboBox.Create(nil) do
try
Parent := TForm.Create(nil);
Top := 50;
Left := 50;
Sorted := True;
OnKeyDown := @Pressed;
for I := 1 to 25 do
Items.Add('Randomness ' + IntToStr(I));
with TForm(Parent) do
try
Width := 200;
Height := 125;
ShowModal;
finally
Free;
end;
finally
Free;
end;
end;

var
V: TVariantArray;

begin
ThreadSafeCall('ShowForm', V);
end.

E, E2: Updated Pressed Function

Bad Boy JH

2011-01-18 05:19:56

I already have a double check feature, which when they hit send, it refuses anything not in the list, and sends them right back to the form to try again… however I wish I didn't need to double check…

Is there a simmilar easy to understand language simmilar to pascal (python?) which has good forms, and functions reasonably simmilar to pascal (with regards to functions etc.)

Dan Cardin

2011-01-18 21:57:29

if you have the double check on the onkeyup event, then you could disable the button from being pressed until it matches whatever item you want. (if i get what you're doing)