PDA

View Full Version : Form tutorial?



Foundry
01-15-2014, 06:57 PM
Can anyone point me to an updated form tutorial? I just want to get a general understanding of them and the ability to make a basic one for a script I am working on. I tried compiling an example from this tutorial (http://villavu.com/forum/showthread.php?t=41418&highlight=form+tutorial) but I got this:


Exception in Script: Unknown declaration "Caption" at line 23, column 7

Obviously the way they are made has changed somehow. I even tried the generated code from the form designer and that didn't work.

Thanatos
01-15-2014, 07:09 PM
http://villavu.com/forum/showthread.php?t=107572

That should work for you :)

kazhual
01-20-2014, 02:30 PM
No it does not.

Foundry means a 'GUI' form, not a player Form.
Looking for the solution as wel.

ThreadSafeCall is also not being recognised.

Totally Broken?

rj
01-20-2014, 02:44 PM
Sorry I can't give you much but here is a basic form for lape:

var
mainForm: TForm;

procedure startform; native;
begin
mainForm.init(nil);
with mainForm do
begin
setWidth(546);
setHeight(200);
setCaption('Hello World');
setPosition(poScreenCenter);
end;
mainForm.showModal();
mainForm.free();
end;

begin
sync(startform);
end.

It's best to follow https://github.com/SRL/SRL-6/blob/master/lib/misc/srlplayerform.simba as to how all the form stuff is added

kazhual
01-20-2014, 02:50 PM
Sorry I can't give you much but here is a basic form for lape:

var
mainForm: TForm;

procedure startform; native;
begin
mainForm.init(nil);
with mainForm do
begin
setWidth(546);
setHeight(200);
setCaption('Hello World');
setPosition(poScreenCenter);
end;
mainForm.showModal();
mainForm.free();
end;

begin
sync(startform);
end.

It's best to follow https://github.com/SRL/SRL-6/blob/master/lib/misc/srlplayerform.simba as to how all the form stuff is added

Thanks for the info, going to take a look right away!

Was looking at the DTM editor.sex and thats written in Pascall.

edit:
The CTR + Spacebar Shows little when comparing to the previous simba.
That always showed what was possible at that line.
really handy in the 'do begin', it would show how to set Caption, Height, etc....



with DsgnForm do
begin
Caption:='DsgnForm';
Left:=174;
Top:=302;
Width:=320;
Height:=240;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=0;
end;

Foundry
01-20-2014, 04:15 PM
Sorry I can't give you much but here is a basic form for lape:

var
mainForm: TForm;

procedure startform; native;
begin
mainForm.init(nil);
with mainForm do
begin
setWidth(546);
setHeight(200);
setCaption('Hello World');
setPosition(poScreenCenter);
end;
mainForm.showModal();
mainForm.free();
end;

begin
sync(startform);
end.

It's best to follow https://github.com/SRL/SRL-6/blob/master/lib/misc/srlplayerform.simba as to how all the form stuff is added

Yeah, this is what I was looking for. I'm looking into it now, thanks!

EDIT: What exactly does setOnClick for the TButtons? I put a procedure in there just like the SRL player form has it but it doesn't call it when I click.

program face;
var
mainForm: TForm;
memo: TMemo;
cool: TEdit;
coolbutton: TButton;

procedure applystuff(sender: TObject); native;
begin
writeLn('got here...');
writeLn(cool.getText());
end;

procedure startform; native;
begin
mainForm.init(nil);
with mainForm do
begin
setWidth(400);
setHeight(600);
setCaption('Hello World');
setPosition(poScreenCenter);
end;
memo.init(mainForm);
with memo do
begin
setParent(mainForm);
setLeft(mainform.getLeft() + 9);
setTop(100);
setWidth(mainForm.getWidth() - 18);
setHeight(100);
setScrollBars(ssAutoBoth);
end;
cool.init(mainform);
with cool do
begin
setParent(mainform);
setLeft(10);
setTop(10);
setHeight(20);
setWidth(mainForm.getWidth() - 18);
end;
coolbutton.init(mainForm);
with coolbutton do
begin
setParent(mainForm);
setLeft(cool.getLeft() + 10);
setTop(cool.getTop() + 27);
setHeight(cool.getHeight());
setWidth(45);
setCaption('no');
setOnClick(applystuff);
end;
mainForm.showModal();
mainForm.free();
end;

begin
sync(startform);
end.

Coh3n
01-20-2014, 06:19 PM
Writeln() doesn't write to the Simba debug box when a form is open (that's why the SRL Player form has a debug box at the bottom). If you open the Simba console you'll see it written there.

Foundry
01-20-2014, 10:20 PM
Writeln() doesn't write to the Simba debug box when a form is open (that's why the SRL Player form has a debug box at the bottom). If you open the Simba console you'll see it written there.

Thanks, I was wondering why it had its own debug box.

kazhual
01-21-2014, 02:11 PM
Writeln() doesn't write to the Simba debug box when a form is open (that's why the SRL Player form has a debug box at the bottom). If you open the Simba console you'll see it written there.

Is there some help for this?
I would like to know all the functions of the variabels ( The prev. simba supported this )
as you can see at the following picture: 22768
I entered the Variable then a '.' and it magically pops up.

Coh3n
01-21-2014, 11:36 PM
Is there some help for this?
I would like to know all the functions of the variabels ( The prev. simba supported this )
as you can see at the following picture: 22768
I entered the Variable then a '.' and it magically pops up.Codehints aren't supported in Lape, but you can view the source files here (https://github.com/MerlijnWajer/Simba/tree/master/Units/MMLAddon/LPInc/Classes/miniLCL). If you find the right parts of the files, they list different form component methods.

Olly
01-22-2014, 12:06 AM
Yea Lape forms are pretty basic, You also can't use any MML stuff which is a pain.

Bixby Sayz
01-22-2014, 04:44 AM
I don't blame him for not wanting to update to SRL-6. It is just about impossible with the lack of auto complete and absolutely zero documentation.

The lack of auto complete is the biggest issue. You don't really need much documentation if you have auto complete.

kazhual
01-22-2014, 08:59 AM
Codehints aren't supported in Lape, but you can view the source files here (https://github.com/MerlijnWajer/Simba/tree/master/Units/MMLAddon/LPInc/Classes/miniLCL). If you find the right parts of the files, they list different form component methods.

Thanks for showing the source file, i've already found that one but still missing parts in that file.
Not all Eventlisteners are defined, 'Onclick'
Some are listed but cant find them in simba : 'BorderStyle'


Is there a Source of the Tform Class ?

Olly
01-23-2014, 08:18 PM
I don't blame him for not wanting to update to SRL-6. It is just about impossible with the lack of auto complete and absolutely zero documentation.

The lack of auto complete is the biggest issue. You don't really need much documentation if you have auto complete.

SRL-6 has its own doc @ http://docs.villavu.com/srl-6/

Code hints are purely based of lape (at-least what i've been told), the decision to switch (for srl-6) to lape was a couple years ago and this is when lape was being dev'd pretty much every week. But now lape hasn't been touched in like a year because nielsie95 doesn't have the time / I dont think deving a interpreter is remotely close to fun. :p


Thanks for showing the source file, i've already found that one but still missing parts in that file.
Not all Eventlisteners are defined, 'Onclick'
Some are listed but cant find them in simba : 'BorderStyle'


Is there a Source of the Tform Class ?

I recently did a commit to Simba one of them things being adding BorderStyle, that is why you you can see it in the source, but it isn't actually in the public Simba version.