Olaan Expert Licensed User Longtime User Nov 24, 2012 #1 Hi all, I need someone could explain to me about initailize(). I saw this at post#9. I can remember that Klaus told me if I built the panel on layout with the designer ,I must not initailize it. I need more knowledge. P.S. I'm sorry,I'm not good at English. Best Regards Theera Last edited: Nov 24, 2012
Hi all, I need someone could explain to me about initailize(). I saw this at post#9. I can remember that Klaus told me if I built the panel on layout with the designer ,I must not initailize it. I need more knowledge. P.S. I'm sorry,I'm not good at English. Best Regards Theera
P Penko Active Member Licensed User Longtime User Nov 24, 2012 #2 Views added with the Designer should NOT be initialized because that's done automatically. Initialization has to do mainly with setting the correct Event for the object. You have to initialize() items which are added dynamically, via code. Code: Copy Dim p As Panel p.Initialize("panel") This sets that events related to the Panel "p" have a prefix "panel". So, if you type "panel_Click", you will catch clicking on the Panel. Upvote 0
Views added with the Designer should NOT be initialized because that's done automatically. Initialization has to do mainly with setting the correct Event for the object. You have to initialize() items which are added dynamically, via code. Code: Copy Dim p As Panel p.Initialize("panel") This sets that events related to the Panel "p" have a prefix "panel". So, if you type "panel_Click", you will catch clicking on the Panel.
Olaan Expert Licensed User Longtime User Nov 24, 2012 #3 I'm lost Hi Penko,Klaus, Why are they different. see this #post11 Upvote 0
Olaan Expert Licensed User Longtime User Nov 24, 2012 #4 Ask some from Example Hi Penko,Klaus, My code is Right? Dim lblMyLabel as Label lblMyLabel.initialize("") Activity.AddView(lblMyLabel, 25%x, 25%y, 50%x, 50%y) Best Regards Theera Upvote 0
Ask some from Example Hi Penko,Klaus, My code is Right? Dim lblMyLabel as Label lblMyLabel.initialize("") Activity.AddView(lblMyLabel, 25%x, 25%y, 50%x, 50%y) Best Regards Theera
klaus Expert Licensed User Longtime User Nov 24, 2012 #5 I would suggest you this code: Code: Copy Sub Globals Dim lblMyLabel As Label End Sub Sub Activity_Create(FirstTime As Boolean) lblMyLabel.initialize("") Activity.AddView(lblMyLabel, 25%x, 25%y, 50%x, 50%y) End Sub this os OK only if you don't use a layout file and you don't want to catch any event from lblMyLabel ! If you want to catch an event from lblMyLabel you must use this code: Code: Copy Sub Globals Dim lblMyLabel As Label End Sub Sub Activity_Create(FirstTime As Boolean) lblMyLabel.initialize("lblMyLabel") Activity.AddView(lblMyLabel, 25%x, 25%y, 50%x, 50%y) End Sub Sub lblMyLabel_Click ' your code for the click event End Sub If lblMyLabel is already in a layout file for exapmle main.bal then you should use this code: Code: Copy Sub Globals Dim lblMyLabel As Label End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("main") End Sub Best regards. Upvote 0
I would suggest you this code: Code: Copy Sub Globals Dim lblMyLabel As Label End Sub Sub Activity_Create(FirstTime As Boolean) lblMyLabel.initialize("") Activity.AddView(lblMyLabel, 25%x, 25%y, 50%x, 50%y) End Sub this os OK only if you don't use a layout file and you don't want to catch any event from lblMyLabel ! If you want to catch an event from lblMyLabel you must use this code: Code: Copy Sub Globals Dim lblMyLabel As Label End Sub Sub Activity_Create(FirstTime As Boolean) lblMyLabel.initialize("lblMyLabel") Activity.AddView(lblMyLabel, 25%x, 25%y, 50%x, 50%y) End Sub Sub lblMyLabel_Click ' your code for the click event End Sub If lblMyLabel is already in a layout file for exapmle main.bal then you should use this code: Code: Copy Sub Globals Dim lblMyLabel As Label End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("main") End Sub Best regards.