Recent

Author Topic: WIN DEATH: Window  (Read 10908 times)

huberte

  • Jr. Member
  • **
  • Posts: 78
WIN DEATH: Window
« on: April 30, 2012, 05:14:09 am »
I have one form, with a button to a second form, nothing special there.

the app crashed when I push the button for the second form :

http://pastebin.com/izcgKGrV

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: WIN DEATH: Window
« Reply #1 on: April 30, 2012, 09:27:38 am »
Also with the example project lazarus/examples/androidtest/ ?

Could you post here your main library project file? Does it contain the clause to create the second form?

huberte

  • Jr. Member
  • **
  • Posts: 78
Re: WIN DEATH: Window
« Reply #2 on: April 30, 2012, 05:07:03 pm »
With my own projetc. Worked with a single form, no I have two.

Mainform:

Quote
useless

opens unit2 (form3)

Quote
useless   

EDIt : dont blame me for the bad programming,  I  guess there is a bettre way to hide button when you click one or another button
« Last Edit: April 30, 2012, 05:49:46 pm by huberte »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: WIN DEATH: Window
« Reply #3 on: April 30, 2012, 05:48:16 pm »
I was asking for the "main library project file", but you have shown the units with the forms. I want to see the one that has "library" written on it.

huberte

  • Jr. Member
  • **
  • Posts: 78
Re: WIN DEATH: Window
« Reply #4 on: May 01, 2012, 06:16:53 am »
Such a noob :( sorry

Do I really need to write this code for all forms ? Even if I have 100 forms ? ?

Quote
procedure MyActivityOnCreate;
begin
  DefaultStyle := dsAndroid;
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
   Application.CreateForm(TForm2, Form3);
  Application.Run;
end;                             

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: WIN DEATH: Window
« Reply #5 on: May 02, 2012, 07:46:36 am »
Do I really need to write this code for all forms ? Even if I have 100 forms ? ?

Yes, for all auto-created forms. In the future the list might be maintained by the IDE, but for now it has to be maintained manually.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: WIN DEATH: Window
« Reply #6 on: May 02, 2012, 04:29:07 pm »
Do I really need to write this code for all forms ? Even if I have 100 forms ? ?
Only if your forms are all of different type. TForm1, TForm2, ... ,TFormSomething100. But if you have 1 type you can use for-loop, and have variable array if needed.

huberte

  • Jr. Member
  • **
  • Posts: 78
Re: WIN DEATH: Window
« Reply #7 on: May 03, 2012, 04:10:13 am »
Different type ?

I have almost 100 forms in preparation, each one have different button and/or image

If I can use something else, could you post the exact syntx  please ? Thks

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: WIN DEATH: Window
« Reply #8 on: May 03, 2012, 11:10:10 am »
Impossible to give syntax because you haven't given anything specific to describe the problem. What kinds of forms exactly are we dealing with? Can you generate the buttons on the fly? Is it a form that has 1 button and 1 label in a spot that you could just calculate and move, then use 1 form type?

TForm1 is a form type. It's the class name in use.

edit:
Code: [Select]
buttonX.caption:=buttonNames[formIndex];
// .. buttonNames could for example be TStringList with each buttons caption.
// formIndex could be property on your form, where you know which one you opened.
In this case you wouldn't need to actually create all 100 forms in preparation. You can create them on the fly, when needed. Same with image
Code: [Select]
image1.Picture.LoadFromFile(imageFiles[formIndex]);
Code: [Select]
myForm:=TMyForm.Create(application);
« Last Edit: May 03, 2012, 11:38:48 am by User137 »

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: WIN DEATH: Window
« Reply #9 on: May 03, 2012, 03:50:49 pm »
An android app with 100 forms? Are you sure you dont have made some huge progect mistakes??? Even calling chaotical a desktop app with 100 forms is a euphemism...

huberte

  • Jr. Member
  • **
  • Posts: 78
Re: WIN DEATH: Window
« Reply #10 on: May 04, 2012, 12:35:45 am »
lol,  :-[

In fact I have a big menu's tree structure. I have about 10 forms with 3 to 10 buttons wich are loading different images (50 to 60)

I guess I can load these images in the same form.
« Last Edit: May 04, 2012, 02:34:45 am by huberte »

 

TinyPortal © 2005-2018