View Full Version : Delphi Help.
Somebody
04-02-2009, 02:23 PM
Hey sorry for posting here but I have no idea where else to. So at my School we started using Turbo Delpi for IT. Lately I have been playing around with it trying to make a few apps and stuff, but I have a problem... My problem mainly is adding 2 forms to one application. I searched online for tutorials but I can't find anything on that. Can someone maybe help me?
Kensei
04-02-2009, 03:14 PM
:: looks for cairnswm or Evil Toaster::
I have not touched Delphi in at least 5 years, but is it not just a case of right clicking and saying 'New Form' ?
glCoolHandf
04-02-2009, 03:22 PM
There is various ways of achiving this, depending on what you require, and also the behaviour of that form.
What delphi are you using, by turbo delphi I assume you are using 2006
Create a VCL Application, that will contain your main form, you will then need to add any number of other forms to that application by simply clicking on File-New-Form (may vary on your delphi, but you need to add a new form, this will also give you a unit2.pas file for the code of the second form)
The above procedure will automatically initialize the form on entering runtime (no need for dynamic creation)
Place the following line in a button.click event on the first form
a.) Form2.Show;
b.) Form2.ShowModal;
These two lines of code vary in behaviour, play with them to see the result of each
P.S. when you type form2 the code insight will not see the form2 member as it is not included in the form1 uses area, but after the first compile it wil include it automaticaly
That is simplies way of adding and showing a form ...
Somebody
04-02-2009, 03:33 PM
Got it thanks alot!!!
no_fear
04-02-2009, 07:27 PM
Ye, and when you use the Form2.show code you can also put a form1.hide, to hide the first form. IIRC you can also get it to close both forms on the exit of either form. Just go to the event handler for exit and type:
Form1.Close;
Form2.Close;
Should work. Unless my delphi knowledge is failing me.
Off topic - first ever post in game.dev :P haha
Kensei
04-02-2009, 10:05 PM
Oooh, I thought you meant physically creating a new form, not writing code to interface between the two -_-*
Ohai no_fear, welcome to the Game.Dev section
no_fear
04-02-2009, 11:01 PM
Heh, delphi is the only programming I know, so will be awhile before I actually contribute :P Did delphi for 3 years in high school. But hey, might take up a different language just as side hobby in the coming years :)
dislekcia
05-02-2009, 12:17 AM
Heh, delphi is the only programming I know, so will be awhile before I actually contribute :P Did delphi for 3 years in high school. But hey, might take up a different language just as side hobby in the coming years :)
Is this the part where we point out that you can totally make games in Delphi? ;)
ET, Cairnswm, unleash the URLS!
01DT!m3r
05-02-2009, 06:16 AM
Is this the part where we point out that you can totally make games in Delphi? ;)
ET, Cairnswm, unleash the URLS!
i programmed pong in delphi 7. I would say stick to gm. Delphi can't redraw the screen to well . ;)
SkinkLizzard
05-02-2009, 10:50 AM
01DT!m3r:
thats when you summon cairnswm
and he unleashes game making libraries (I thinks) on the offending
delphi
S2DL. (http://www.cairnsgames.co.za/files/s2dl.zip)
Simple 2D Libraries ver 2.00 has been Released
My easy to use S2DL libraries for Delphi and Free Pascal (Windows, Linux and MacOS) has been upgraded to version 2.00. The new version of S2DL has some small name changes to the classes to conform to my new naming conventions.
S2DL ver 2.00 includes:
Image Management
Sound Management
Font Management
A state management system
A basic game template
The following Demos are included:
Hello World
Flies
StateDemo
TileMap
S2DL is free for anyone to use, for free, shareware or commercial games.
Chippit
05-02-2009, 04:03 PM
Yeah, Delphi's more than able to make games. Some of the earliest stuff I posted here I made in Delphi, including ND2.
no_fear
05-02-2009, 08:29 PM
Ye, I was told Delphi was able to make games. Was supposed to be one of our assignments for matric. Never happened that way. I had a way to make the character run across the screen! :P was fool proof! Ie:
image1.left := num + 1;
each time the action was used.
Then change the image each time it moved. Would of worked, I swear :D Will actually try it when I can find my delphi CD. Could be fun :) heh. Shouldn't be too hard to make a mini platformer?
ShadowMaster
05-02-2009, 08:46 PM
Well GM is written in Delphi... So you should be able to do a lot in it.
cairnswm
06-02-2009, 07:58 AM
Best place for Delphi Game Dev stuff is
www.pascalgamedevelopment.com
There are a wide range of 2D libraries and a number of 3D game libraries as well. None of them seem to be totally dominant but all are very user friendly (which is why I use Delphi).
:)
AndrewJ
06-02-2009, 08:46 AM
Well GM is written in Delphi... So you should be able to do a lot in it.Oh darn! Do you think that anyone actually would want to use it knowing that it's been developed in DELPHI of all things??? ;-)
01DT!m3r
08-02-2009, 10:03 AM
We have been using delphi 7 for IT for ages now . I wanted to do visual c# but the government thinks otherwise . What do you guys believe would be the best language to study for matric ?
ShadowMaster
08-02-2009, 10:49 AM
I would think the best language for high school would be something like Python, where more of the emphasis on teaching programming and not the language itself, because learning programming properly > barely knowing a popular programming language.
XERXES
08-02-2009, 11:05 AM
We do Java in It.
01DT!m3r
08-02-2009, 12:50 PM
I have heard from my teacher that alot of the private schools do java and some of the public schools as well ,I would prefer it to delphi .
@shadowmaster : I agree with you ,but thats exactly what they aren't teaching us , not at my school anyways.
no_fear
08-02-2009, 01:44 PM
I was under the impression that private schools did Java, and government schools delphi... I dunno, I think that delphi is quite easy to pick up
Kensei
08-02-2009, 03:02 PM
I am not sure if the British O-Levels and A-Levels have changed since I was studying but I had to do Delphi when I was in high school.
It was only at university that I was introduced to Java (and I taught myself C# :p ) although that was the programming language the Australian degree demanded (I went to Bond South Africa = International Australian degree certified by Bond University in Aus) But it appears my sister, who is studying at Rhodes, do Python and C at undergraduate level.
ShadowMaster
08-02-2009, 04:04 PM
I was under the impression that private schools did Java, and government schools delphi... I dunno, I think that delphi is quite easy to pick up
The different provinces either do delphi or Java, in the Western Cape we do Java. In the Free State and Guateng it's delphi afaik.
SkinkLizzard
08-02-2009, 09:23 PM
kzn is java as well, although the algorithms and programming logic they teach don't generally change much.
sorts,searches and most loops work in more or less the same way regardless of
language I think.
Gen_ Wolf
08-02-2009, 10:41 PM
Yea in JoBurg under IEB and doing Delphi so I mean programming is programming, once you get to Uni they start from scratch so its good to have experience in programming i guess, doesn't matter on the language
Karuji
08-02-2009, 11:33 PM
JHB(Gauteng) is either Delphi or Java (The school makes the choice). Mine does Delphi which I hate. Not that delphi is a bad language to program in. Just that the text books and the IT curriculum is horrid. I have learnt more about programming from hanging(lurking) around here then school. And what I have been doing in school for about 3 years now I mange to do that and more in one month by reading a book.
Personally I'd love to do Visual C# but Shadow makes a good point that they should teach programming and not the language. Which I have noticed they have been trying in the theory section (via algorithms, but are completely failing)
Ok enough pointless rabble from me for the month ;)
AndrewJ
09-02-2009, 11:20 AM
I agree that learning a specific language is very bad for one. One should rather learn how to program, learn algorithms - not off by heart like a parrot, but HOW they work and WHY they are done in that way. I took CompSci as a seventh subject (had to take it in Afrikaans for Std. 9 and 10 - I'm English) and not only did I brush up on my Afrikaans, but also managed to make friends with really hot Afrikaans girls. Oh, and it also gave me some good foundations for varsity.
01DT!m3r
09-02-2009, 04:01 PM
Exactly . I agree with you andrewj . We should learn how and why . Not study parrot fashion.
Karuji
09-02-2009, 04:35 PM
Well algorithms are great but if you don't know a language you can;t really program, just a bit of irony ;)
To make my point school fail. In IT we are taught pointless local conventions which is purely because that's what is going to be on the memo for the exam. School teaches you to pass an exam which is why it fails. The exams test hypothetical and improbable situations which will never in all likelihood happen. And I swear if they tell me to do another program of taking data from an ID I will kill some one.
Somebody
09-02-2009, 04:36 PM
Edit- Nvm. Got the answer I needed.
Powered by vBulletin® Version 4.2.4 Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.