Olaan Expert Licensed User Longtime User May 31, 2013 #1 Hi all, I'm studying about the custom view,I 've added the custom spinner in the example. But I couldn't finish my work. Please help me. Last edited: Jun 20, 2013
Hi all, I'm studying about the custom view,I 've added the custom spinner in the example. But I couldn't finish my work. Please help me.
klaus Expert Licensed User Longtime User May 31, 2013 #2 Attached two modified versions. CustomViewSpinner_1 code for Designer support only CustomViewSpinner_2 code for Designer support and for adding the custom view by code. Did you have a look at the last update of the User's Guide ? Best regards. Attachments CustomViewSpinner_1.zip CustomViewSpinner_1.zip 8.7 KB · Views: 309 CustomViewSpinner_2.zip CustomViewSpinner_2.zip 8.8 KB · Views: 314 Upvote 0
Attached two modified versions. CustomViewSpinner_1 code for Designer support only CustomViewSpinner_2 code for Designer support and for adding the custom view by code. Did you have a look at the last update of the User's Guide ? Best regards.
Olaan Expert Licensed User Longtime User Jun 1, 2013 #4 My Wanted is Hi Klaus, In your example1 for give me,I'm sorry that I explained my wanted is not clearly. If I would like using customcboBox.selectedItem in main of program,I couldn't do it. I couldn't set cboBox.selectedItem=lbl.text in samplecbobox.bas ,because it warns that be "Read Only" Upvote 0
My Wanted is Hi Klaus, In your example1 for give me,I'm sorry that I explained my wanted is not clearly. If I would like using customcboBox.selectedItem in main of program,I couldn't do it. I couldn't set cboBox.selectedItem=lbl.text in samplecbobox.bas ,because it warns that be "Read Only"
klaus Expert Licensed User Longtime User Jun 1, 2013 #5 A Spinner doesn't allow to set SelectedItem, this property is read only. If you want to define such a 'property' and set it you'd need to memorize all items of the Spinner in a list, modify the the selected item in the list, clear the spinner, and reload all the items from the list into the Spinner. You find an explanation on how to add properties to a class in the User's Guide. Best regards. Upvote 0
A Spinner doesn't allow to set SelectedItem, this property is read only. If you want to define such a 'property' and set it you'd need to memorize all items of the Spinner in a list, modify the the selected item in the list, clear the spinner, and reload all the items from the list into the Spinner. You find an explanation on how to add properties to a class in the User's Guide. Best regards.
Olaan Expert Licensed User Longtime User Jun 2, 2013 #6 A Spinner doesn't allow to set SelectedItem, this property is read only. Click to expand... Hi Erel, I'm not sure, Is this custom view feather useful? I think myself why do you give our use this "Public Sub DesignerCreateView(Base As Panel, lbl As Label, Props As Map)"? Why don't you give use "Public Sub DesignerCreateView(Base As Panel, cbobox As spinner, Props As Map)?,The second parameter is varied as follow the custom view,If I create the custom view as spinner. the lbl has not the method. Last edited: Jun 2, 2013 Upvote 0
A Spinner doesn't allow to set SelectedItem, this property is read only. Click to expand... Hi Erel, I'm not sure, Is this custom view feather useful? I think myself why do you give our use this "Public Sub DesignerCreateView(Base As Panel, lbl As Label, Props As Map)"? Why don't you give use "Public Sub DesignerCreateView(Base As Panel, cbobox As spinner, Props As Map)?,The second parameter is varied as follow the custom view,If I create the custom view as spinner. the lbl has not the method.
Erel B4X founder Staff member Licensed User Longtime User Jun 2, 2013 #7 Is this custom view feather useful? Click to expand... This is an optional tool. If it is not useful for your task then you should not use it. You can see two new useful examples here: [Class] AnotherDatePicker - A simple "web style" date picker [Class] CustomListView - A flexible list based on ScrollView Upvote 0
Is this custom view feather useful? Click to expand... This is an optional tool. If it is not useful for your task then you should not use it. You can see two new useful examples here: [Class] AnotherDatePicker - A simple "web style" date picker [Class] CustomListView - A flexible list based on ScrollView
klaus Expert Licensed User Longtime User Jun 2, 2013 #8 You should also read carefully the User's Guide. The purpose of Public Sub DesignerCreateView(Base As Panel, lbl As Label, Props As Map) is explained in chapter 10.6 Display a custom view in the Designer the roles of Base, lbl and Map too. As explained in post #5, the SelectedItem property of a Spinner is read only you cannot set it ! If you want a settable SelectedItem property in your custom view you must add it in the code as explained in post #5. How to add properties to a CustomView is explained in detail in the User's Guide chapter 10.5 Add properties to a class, concrete examples are in chapters 10.3 and 10.4. Any property you want for your CustomView must be added in the Class code. The original properties of any view you add in the class are not directly accessible from outsides the class. Best regards. Last edited: Jun 2, 2013 Upvote 0
You should also read carefully the User's Guide. The purpose of Public Sub DesignerCreateView(Base As Panel, lbl As Label, Props As Map) is explained in chapter 10.6 Display a custom view in the Designer the roles of Base, lbl and Map too. As explained in post #5, the SelectedItem property of a Spinner is read only you cannot set it ! If you want a settable SelectedItem property in your custom view you must add it in the code as explained in post #5. How to add properties to a CustomView is explained in detail in the User's Guide chapter 10.5 Add properties to a class, concrete examples are in chapters 10.3 and 10.4. Any property you want for your CustomView must be added in the Class code. The original properties of any view you add in the class are not directly accessible from outsides the class. Best regards.
Olaan Expert Licensed User Longtime User Jun 2, 2013 #9 Hi Erel,Klaus @Erel, I'm sorry to said that my language is not translate to be the worst. I hope that the feater is nearly as ActiveX which be used in VB6.0 In VB6.0 has many objects for using. I think that B4A product is the best product in decade. @Klaus,I'm not good at programing,I would you to show me example. I hope for kind of you. Last edited: Jun 20, 2013 Upvote 0
Hi Erel,Klaus @Erel, I'm sorry to said that my language is not translate to be the worst. I hope that the feater is nearly as ActiveX which be used in VB6.0 In VB6.0 has many objects for using. I think that B4A product is the best product in decade. @Klaus,I'm not good at programing,I would you to show me example. I hope for kind of you.
klaus Expert Licensed User Longtime User Jun 2, 2013 #10 I think you should try it on your own. That's the BEST way to learn and get experience ! If then you have trouble we can help you. Best regards. Upvote 0
I think you should try it on your own. That's the BEST way to learn and get experience ! If then you have trouble we can help you. Best regards.
Erel B4X founder Staff member Licensed User Longtime User Jun 2, 2013 #11 @Erel, I'm sorry to said that my language is not translate to be the worst. I hope that the feater is nearly as ActiveX which be used in VB6.0 In VB6.0 has many objects for using. I think that B4A product is the best product in decade. Click to expand... No problem at all. Upvote 0
@Erel, I'm sorry to said that my language is not translate to be the worst. I hope that the feater is nearly as ActiveX which be used in VB6.0 In VB6.0 has many objects for using. I think that B4A product is the best product in decade. Click to expand... No problem at all.
Olaan Expert Licensed User Longtime User Jun 3, 2013 #12 Hi Klaus, I've read your UserGuide at 10.5 Page 155,I need to ask you the following lines below Code: Copy Code in the calling module : ltbTest.Max= MaxValue I don't know that MaxValue and ltbTest.Max come from,Why does ltbTest know his the member?,ltbTest.Max is used always in Sub Activity_Resume or not? ,I should declare MaxVal this format Code: Copy Private MaxVal as Int in Class Module or Public MaxVal as Int in Sub Globals? Upvote 0
Hi Klaus, I've read your UserGuide at 10.5 Page 155,I need to ask you the following lines below Code: Copy Code in the calling module : ltbTest.Max= MaxValue I don't know that MaxValue and ltbTest.Max come from,Why does ltbTest know his the member?,ltbTest.Max is used always in Sub Activity_Resume or not? ,I should declare MaxVal this format Code: Copy Private MaxVal as Int in Class Module or Public MaxVal as Int in Sub Globals?
Olaan Expert Licensed User Longtime User Jun 3, 2013 #13 Hi Klaus, I could do it already. Yahoo!,Thank you for help,Please answer post #12 too,I still not understand all. Last edited: Jun 20, 2013 Upvote 0
Hi Klaus, I could do it already. Yahoo!,Thank you for help,Please answer post #12 too,I still not understand all.
klaus Expert Licensed User Longtime User Jun 3, 2013 #14 Code in the calling module : ltbTest.Max = MaxValue MaxValue must be declared somewher Dim MaxValue As Int and set a value to it, you could also use: ltbTest.Max = 100 In the calling routine ltbTest.Max is known because in the class we have two routines setMax and getMax ! When you add in a Class a routine like setMyProperty and/or getMyProperty B4A adds MyProperty as a property to the custonview. Best regards. Upvote 0
Code in the calling module : ltbTest.Max = MaxValue MaxValue must be declared somewher Dim MaxValue As Int and set a value to it, you could also use: ltbTest.Max = 100 In the calling routine ltbTest.Max is known because in the class we have two routines setMax and getMax ! When you add in a Class a routine like setMyProperty and/or getMyProperty B4A adds MyProperty as a property to the custonview. Best regards.
Olaan Expert Licensed User Longtime User Jun 3, 2013 #15 Many Thanks ,Klaus You help me learning more. I have some question about coding in Post#13,Why do not I have selectedData as property of customCboBox?,but I have both setselectedData and getselectedData instead of it. How should I do for this coding? Last edited: Jun 3, 2013 Upvote 0
Many Thanks ,Klaus You help me learning more. I have some question about coding in Post#13,Why do not I have selectedData as property of customCboBox?,but I have both setselectedData and getselectedData instead of it. How should I do for this coding?
klaus Expert Licensed User Longtime User Jun 3, 2013 #16 When you add these two routines in the Class module setSelectedData and getSelectedData you will see in the calling module the SelectedData property. getSelectedData could look like this: Code: Copy Sub getSelectedData As Object Return cboBox.SelectedItem End Sub For setSelectedData it depends on what exactly you want to do. Code: Copy Sub setSelectedData(Value As Object) ' your code End Sub Best regards. Upvote 0
When you add these two routines in the Class module setSelectedData and getSelectedData you will see in the calling module the SelectedData property. getSelectedData could look like this: Code: Copy Sub getSelectedData As Object Return cboBox.SelectedItem End Sub For setSelectedData it depends on what exactly you want to do. Code: Copy Sub setSelectedData(Value As Object) ' your code End Sub Best regards.
Olaan Expert Licensed User Longtime User Jun 4, 2013 #17 Hi Klaus, Excause me for my stupid, the coding #13 ,I have picture as below. I don't understand that you have tried to explain. Please to give me the full version of solved. I need to know about different between yours and mine. I couldn't see customcbobox.selectedData member as property. Last edited: Jun 20, 2013 Upvote 0
Hi Klaus, Excause me for my stupid, the coding #13 ,I have picture as below. I don't understand that you have tried to explain. Please to give me the full version of solved. I need to know about different between yours and mine. I couldn't see customcbobox.selectedData member as property.
klaus Expert Licensed User Longtime User Jun 4, 2013 #18 I saw the problem with getSelectedData which was not normal, to correct it I deleted the line and wrote it again. Attached you find an example on how it could be. Best regards. Attachments CustomViewSpinner3.zip CustomViewSpinner3.zip 8.5 KB · Views: 293 Upvote 0
I saw the problem with getSelectedData which was not normal, to correct it I deleted the line and wrote it again. Attached you find an example on how it could be. Best regards.
Olaan Expert Licensed User Longtime User Jun 6, 2013 #19 Hi Klaus, I'm understand now. Thank you for kind of you again. Upvote 0