M MroBurk Member Licensed User Jan 7, 2022 #1 Hi there, I need to create a label in sequence with Spinner's text like in the images attached. I tried the link below but it doesn't better for my app... Thanks for any ideas.. TagView V1.0.0 This is a wrap for this github project. TagView Version: 1 TagView Methods: Initialize (tagtext As String) IsInitialized As Boolean isDeletable As Boolean Properties: Background As Drawable Deletable As Boolean [write only] DeleteIcon As String DeleteIndicatorColor As Int... www.b4x.com Attachments spinner4.jpg 59.1 KB · Views: 503 spinner3.jpg 56.5 KB · Views: 497 spinner2.jpg 54.6 KB · Views: 484 spinner1.jpg 50.8 KB · Views: 488
Hi there, I need to create a label in sequence with Spinner's text like in the images attached. I tried the link below but it doesn't better for my app... Thanks for any ideas.. TagView V1.0.0 This is a wrap for this github project. TagView Version: 1 TagView Methods: Initialize (tagtext As String) IsInitialized As Boolean isDeletable As Boolean Properties: Background As Drawable Deletable As Boolean [write only] DeleteIcon As String DeleteIndicatorColor As Int... www.b4x.com
M MroBurk Member Licensed User Jan 7, 2022 #2 I tried to create a project like I need! Attachments Label radiobutton e spinner.zip Label radiobutton e spinner.zip 10.7 KB · Views: 351 Upvote 0
M Mahares Expert Licensed User Longtime User Jan 7, 2022 #3 MroBurk said: I need to create a label in sequence with Spinner's text like in the images attached. I tried the link below but it doesn't better for my app... Click to expand... If you are looking to color the label based on the color chosen in the spinner, you can create a sub like this: Code: Copy Sub ColorLabel(l As Label) If a.Contains("red") Then l.color = Colors.Red else if a.Contains("green") Then l.color = Colors.Green else if a.Contains("yellow") Then l.color = Colors.Yellow End If End Sub And your button1 code will be something like this: Code: Copy Private Sub Button1_Click If Label1.Text = "" Then Label1.Visible=True Label1.Text= a ColorLabel(Label1) Else If Label2.Text = "" Then Label2.Visible=True Label2.Text= a ColorLabel(Label2) Else If Label3.Text = "" Then Label3.Visible=True Label3.Text= a ColorLabel(Label3) Else If Label4.Text = "" Then Label4.Visible=True Label4.Text= a ColorLabel(Label4) Else If Label5.Text = "" Then Label5.Visible=True Label5.Text= a ColorLabel(Label5) Else If Label6.Text = "" Then Label6.Visible=True Label6.Text= a ColorLabel(Label6) 'finish rest of labels like above End sub Upvote 0
MroBurk said: I need to create a label in sequence with Spinner's text like in the images attached. I tried the link below but it doesn't better for my app... Click to expand... If you are looking to color the label based on the color chosen in the spinner, you can create a sub like this: Code: Copy Sub ColorLabel(l As Label) If a.Contains("red") Then l.color = Colors.Red else if a.Contains("green") Then l.color = Colors.Green else if a.Contains("yellow") Then l.color = Colors.Yellow End If End Sub And your button1 code will be something like this: Code: Copy Private Sub Button1_Click If Label1.Text = "" Then Label1.Visible=True Label1.Text= a ColorLabel(Label1) Else If Label2.Text = "" Then Label2.Visible=True Label2.Text= a ColorLabel(Label2) Else If Label3.Text = "" Then Label3.Visible=True Label3.Text= a ColorLabel(Label3) Else If Label4.Text = "" Then Label4.Visible=True Label4.Text= a ColorLabel(Label4) Else If Label5.Text = "" Then Label5.Visible=True Label5.Text= a ColorLabel(Label5) Else If Label6.Text = "" Then Label6.Visible=True Label6.Text= a ColorLabel(Label6) 'finish rest of labels like above End sub
M MroBurk Member Licensed User Jan 7, 2022 #4 Thanks for this, but my question is: I need to create label without labels created in the design... But from the code... if I select an item and I click on the button, the code creates a label with text selected... I don't know if this is possible... I see xui.CreateLabels but I don't know how to use it... Upvote 0
Thanks for this, but my question is: I need to create label without labels created in the design... But from the code... if I select an item and I click on the button, the code creates a label with text selected... I don't know if this is possible... I see xui.CreateLabels but I don't know how to use it...
M Mahares Expert Licensed User Longtime User Jan 10, 2022 #5 MroBurk said: but my question is: I need to create label without labels created in the design... But from the code Click to expand... If your question was to create the labels by code, why did you then upload your project with the labels already created with the designer. MroBurk said: I don't know if this is possible.. Click to expand... It is possible. Here is the code you need for an array of 8 labels by code. Make sure the layout Layoutlabel when loaded should only have the 3 radio buttons, spinner1 and button1. The labels will be created by code in one column, but you can tweak the app to make 3 columns of labels. Please note that after the 8th label the button1 is disabled so the app stops adding labels. Code: Copy Sub Globals Private a As String Private Panel1 As Panel Private RadioButtonGreen As RadioButton Private RadioButtonRed As RadioButton Private RadioButtonyellow As RadioButton Private Spinner1 As Spinner Dim GreenArr(2), RedArr(3),YellowArr (4)As String Private Button1 As Button Private n As Int =8 'number of labels. You can change this to any number to have more labels Private lbl(n) As Label Private i As Int =0 End Sub Code: Copy Private Sub Button1_Click Dim w =200dip, h=50dip As Float lbl(i).Initialize("lbl") Activity.AddView(lbl(i), 0,i*60dip+200dip, w, h) lbl(i).Text= a lbl(i).TextSize = 20 ColorLabel(lbl(i)) i=i+1 If i=n Then Button1.Enabled =False End Sub Upvote 0
MroBurk said: but my question is: I need to create label without labels created in the design... But from the code Click to expand... If your question was to create the labels by code, why did you then upload your project with the labels already created with the designer. MroBurk said: I don't know if this is possible.. Click to expand... It is possible. Here is the code you need for an array of 8 labels by code. Make sure the layout Layoutlabel when loaded should only have the 3 radio buttons, spinner1 and button1. The labels will be created by code in one column, but you can tweak the app to make 3 columns of labels. Please note that after the 8th label the button1 is disabled so the app stops adding labels. Code: Copy Sub Globals Private a As String Private Panel1 As Panel Private RadioButtonGreen As RadioButton Private RadioButtonRed As RadioButton Private RadioButtonyellow As RadioButton Private Spinner1 As Spinner Dim GreenArr(2), RedArr(3),YellowArr (4)As String Private Button1 As Button Private n As Int =8 'number of labels. You can change this to any number to have more labels Private lbl(n) As Label Private i As Int =0 End Sub Code: Copy Private Sub Button1_Click Dim w =200dip, h=50dip As Float lbl(i).Initialize("lbl") Activity.AddView(lbl(i), 0,i*60dip+200dip, w, h) lbl(i).Text= a lbl(i).TextSize = 20 ColorLabel(lbl(i)) i=i+1 If i=n Then Button1.Enabled =False End Sub
M MroBurk Member Licensed User Jan 12, 2022 #6 Great!! That is what I needed!!! Thank you very much!!!!! Ps.: I posted that code for an example of what I wanted to create... Upvote 0
Great!! That is what I needed!!! Thank you very much!!!!! Ps.: I posted that code for an example of what I wanted to create...
Alexander Stolte Expert Licensed User Longtime User Jan 12, 2022 #7 [B4X] [XUI] AS ScrollingChips based on xCustomListView - Display your Hashtags or Categories I removed the old code and took the code from the AS_Chips to make this view even better. I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal. :) Without scroll... www.b4x.com Upvote 0
[B4X] [XUI] AS ScrollingChips based on xCustomListView - Display your Hashtags or Categories I removed the old code and took the code from the AS_Chips to make this view even better. I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal. :) Without scroll... www.b4x.com