R Ramirez Member Licensed User Longtime User Aug 25, 2011 #1 Hello I try this code adapted from a Klaus post Code: Copy 'Activity module Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals ' nécessaire pour dessiner la courbe Dim tableau As Canvas Dim courbe As Path Dim Panneau As Panel Dim Image As Bitmap 'objects graphiques Dim lblDate As Label End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("formHistory") ' Affichage de la date du jour '------------------------------ DateTime.DateFormat = "dd/MM/yyyy" lblDate.Text=DateTime.Date(DateTime.Now) ' Création de la zone de dessin '------------------------------- Panneau.Width = 300 Panneau.Left = 0 Panneau.Top = 360 Panneau.Height = 140 tableau.Initialize(Panneau) Image.Initialize3(tableau.Bitmap) End Sub I don't understand what is the difference between my code and the Klaus code, but mine give me an error : "Object should be first initialized (panel)" Any idea of my mistake ?
Hello I try this code adapted from a Klaus post Code: Copy 'Activity module Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals ' nécessaire pour dessiner la courbe Dim tableau As Canvas Dim courbe As Path Dim Panneau As Panel Dim Image As Bitmap 'objects graphiques Dim lblDate As Label End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("formHistory") ' Affichage de la date du jour '------------------------------ DateTime.DateFormat = "dd/MM/yyyy" lblDate.Text=DateTime.Date(DateTime.Now) ' Création de la zone de dessin '------------------------------- Panneau.Width = 300 Panneau.Left = 0 Panneau.Top = 360 Panneau.Height = 140 tableau.Initialize(Panneau) Image.Initialize3(tableau.Bitmap) End Sub I don't understand what is the difference between my code and the Klaus code, but mine give me an error : "Object should be first initialized (panel)" Any idea of my mistake ?
D dagnabitboy Active Member Licensed User Longtime User Aug 25, 2011 #2 After Activity.LoadLayout... put: Panneau.Initialize Upvote 0
R Ramirez Member Licensed User Longtime User Aug 25, 2011 #3 In this case, "Missing parameters" because it's necessary to specify a taget. If I specify Code: Copy Panneau.Initialize(Activity) I have a failure: Java.lang.NullPointerException Upvote 0
In this case, "Missing parameters" because it's necessary to specify a taget. If I specify Code: Copy Panneau.Initialize(Activity) I have a failure: Java.lang.NullPointerException
klaus Expert Licensed User Longtime User Aug 25, 2011 #4 I'm afraid that you don't have a Panel with the name 'Panneau' in your formHistory layout. Initialize is needed if you add views by code but you must also add this view to a parent view. Initialize is not needed when the view is defined in the layout file. You should use this code if you want to use event from the panel: Code: Copy Panneau.Initialize("Panneau") Activity.AddView(Panneau, 0, 360, 300, 140) And you could use this code if you don't want to use event from the panel: Code: Copy Panneau.Initialize("") Activity.AddView(Panneau, 0, 360, 300, 140) To be able to give you a concrete answer we need to have your whole project as a zip file (IDE menu File/Export As zip. Best regards. Upvote 0
I'm afraid that you don't have a Panel with the name 'Panneau' in your formHistory layout. Initialize is needed if you add views by code but you must also add this view to a parent view. Initialize is not needed when the view is defined in the layout file. You should use this code if you want to use event from the panel: Code: Copy Panneau.Initialize("Panneau") Activity.AddView(Panneau, 0, 360, 300, 140) And you could use this code if you don't want to use event from the panel: Code: Copy Panneau.Initialize("") Activity.AddView(Panneau, 0, 360, 300, 140) To be able to give you a concrete answer we need to have your whole project as a zip file (IDE menu File/Export As zip. Best regards.
R Ramirez Member Licensed User Longtime User Aug 25, 2011 #5 RHAAAAA I love you Klauss :sign0100: You're right, I don't create panel on my layout ! :BangHead: I understand my mistake thanks a lot. Upvote 0
RHAAAAA I love you Klauss :sign0100: You're right, I don't create panel on my layout ! :BangHead: I understand my mistake thanks a lot.