View Full Version : forms in simba
g0tp0t
09-20-2010, 06:05 PM
i use createform but it isn't recognized in simba, i haven't found anything in the forums that shows other people successfully using forms in simba. is it possible?
the reason i want a form is so i can draw on it, i cant seem to get the debug windows canvas so i cant draw in there, =\
Wizzup?
09-20-2010, 06:19 PM
TForm.Create? Remember that all the form stuff should be in ThreadSafeCalls.
So that's why I've been failing to get my player form off the ground.:duh:
We need some Updated Form Tut's for Simba
~Brak
Shuttleu
09-20-2010, 06:51 PM
also if you include srl then you can use CreateForm
~shut
Dgby714
09-20-2010, 06:53 PM
TForm.Create? Remember that all the form stuff should be in ThreadSafeCalls.
After looking in simba wouldn't it be "TForm.Create(nil);"? or should something else go as the parameter?
Wizzup?
09-20-2010, 06:56 PM
After looking in simba wouldn't it be "TForm.Create(nil);"? or should something else go as the parameter?
Nil would do, yeah.
g0tp0t
09-27-2010, 04:14 PM
iv been trying to figure simba out, and havnt found any tutorials for drawing or using forms. It doesnt look like ther are manyt tuts at all. I would really like to see a thread with many differences between scar and simba.
Ohh, i hink i found a bug,
program new;
var form : Tform;
begin
form := tform.create(nil);
form.show;
end.
Result is the border of the form appears but the form itself is transparent, and simba crashes.
EDIT: stupid stupid stupid, haha. didnt use threadsafecall.
Edit2:
program new;
var
form : tform;
dx1,dx2,dy1,dy2,cr,t,h,k:integer;
v : TVariantArray;
procedure paint(sender : TObject);
begin
t := t+1;
dx1 := round(cr*cos(t)+h)
dy1 := round(cr*sin(t)+k)
dx2 := round(cr*cos(t)-h)
dy2 := round(cr*sin(t)-k)
form.CANVAS.Ellipse(dx1-cr,dy1-cr,dx2+cr,dy2+cr)
end;
procedure show;
begin
cr := 2;
h := 250;
k := 250;
form := tform.Create(nil);
form.width := 500;
form.height := 500;
form.show;
form.ONPAINT := @paint;
end;
begin
ThreadSafeCall('show', v);
end.
output :
Error: Exception: Invalid type cast at line 30
Am i doing something wrong?
Wizzup?
09-27-2010, 09:42 PM
I fixed the tags for you. Use [ simba ] and not < simba >. :)
Mr. Doctor
09-27-2010, 09:50 PM
program new;
var
form : tform;
dx1,dx2,dy1,dy2,cr,t,h,k:integer;
v : TVariantArray;
procedure paint(sender : TObject);
begin
t := t+1;
dx1 := round(cr*cos(t)+h)
dy1 := round(cr*sin(t)+k)
dx2 := round(cr*cos(t)-h)
dy2 := round(cr*sin(t)-k)
form.CANVAS.Ellipse(dx1-cr,dy1-cr,dx2+cr,dy2+cr)
end;
procedure InItForm;
begin
cr := 2;
h := 250;
k := 250;
form := tform.Create(nil);
form.width := 500;
form.height := 500;
form.show;
form.ONPAINT := @paint;
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
form.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
begin
SafeInitForm;
SafeShowFormModal;
ThreadSafeCall('show', v);
end.
http://villavu.com/forum/showthread.php?t=12000
Wizzup?
09-27-2010, 09:51 PM
You should really use ShowModal (as Mr Doctor did) because that way your Form stuff will keep running in the main thread; until the form is closed. If you use just .Show; the method will return immediately and all events (including onPaint) will be called on the script thread. (AFAIK anyway, I really hate forms, did I mention this before? ;) )
g0tp0t
09-28-2010, 05:15 PM
sweet, the forms seem overcomplicated. lol
ty for formmodal and the tag change =]. is the source openly available? im wondering because i would like to see the functions and form stuff.
I really wish there was a getdubugcanvas like ther is in scar. painting on canvas is easier. =\
Wizzup?
09-29-2010, 11:11 PM
sweet, the forms seem overcomplicated. lol
ty for formmodal and the tag change =]. is the source openly available? im wondering because i would like to see the functions and form stuff.
I really wish there was a getdubugcanvas like ther is in scar. painting on canvas is easier. =\
The source is openly available. http://wizzup.org/simba/article/3
g0tp0t
09-30-2010, 11:53 AM
ok, i went but i cant find a way to see the source code, this is written in delphi or pascal right? how was it compiled
Wizzup?
09-30-2010, 12:37 PM
ok, i went but i cant find a way to see the source code, this is written in delphi or pascal right? how was it compiled
http://villavu.com/forum/showthread.php?t=58000 :)
g0tp0t
09-30-2010, 01:11 PM
can the code be seen without lazarus and fpc?
Wizzup?
09-30-2010, 01:15 PM
can the code be seen without lazarus and fpc?
You can view all .pas files in pretty much every text editor, including notepad.
g0tp0t
09-30-2010, 05:32 PM
how do i view pas files, i saw the git and clicked and then it wanted to download a file but not a pas
Wizzup?
09-30-2010, 05:52 PM
You can also view the raw version on the site. And if you download the source you can just open it in notepad. The .pas files too.
g0tp0t
09-30-2010, 06:42 PM
k, ill try that, havnt seen the .pas files, only snapshots.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.