Nov 6, 2018 Replies: 36 This is a simple start for a Toggleswitch Customview for B4j. It is deliberately not a B4X Customview as I wanted it to be styleable via CSS. The animation duration is set, but you could very easily add a designer property to allow changing it in the Designer. The 3 components can be styled in the css file included in the project. Don't forget to add the Stylesheet to an appropriate place. Attachments ToggleSwitch.zip ToggleSwitch.zip 3.4 KB · Views: 818 Last edited: Nov 7, 2018 Click to expand...
This is a simple start for a Toggleswitch Customview for B4j. It is deliberately not a B4X Customview as I wanted it to be styleable via CSS. The animation duration is set, but you could very easily add a designer property to allow changing it in the Designer. The 3 components can be styled in the css file included in the project. Don't forget to add the Stylesheet to an appropriate place.
stevel05 Expert Licensed User Longtime User Nov 7, 2018 #21 Hi Roger, This thread just contains a very basic implementation that anybody can use as a template and change as they wish. If you want to share your modified version, feel free to do so in a new thread and explain what you have changed. BTW, there is a small error (check the log window) that should be addressed before you share it.
Hi Roger, This thread just contains a very basic implementation that anybody can use as a template and change as they wish. If you want to share your modified version, feel free to do so in a new thread and explain what you have changed. BTW, there is a small error (check the log window) that should be addressed before you share it.
ThRuST Well-Known Member Licensed User Longtime User Nov 7, 2018 #22 ok I should update my previous post, sorry for taking advantage of your code. I do like my addions, it made it a bit better in fact
ok I should update my previous post, sorry for taking advantage of your code. I do like my addions, it made it a bit better in fact
stevel05 Expert Licensed User Longtime User Nov 7, 2018 #23 ThRuST said: sorry for taking advantage of your code. Click to expand... That's what it's here for
ThRuST Well-Known Member Licensed User Longtime User Nov 7, 2018 #24 Well I made it better so we can both complain haha
ThRuST Well-Known Member Licensed User Longtime User Nov 7, 2018 #25 What bug are you talking about? Both of our code is perfect. Or are you trying to tell me something else? What if I'm Tuco's brother in Breakin' bad Steve (Netflix success TV series) hahaha
What bug are you talking about? Both of our code is perfect. Or are you trying to tell me something else? What if I'm Tuco's brother in Breakin' bad Steve (Netflix success TV series) hahaha
ThRuST Well-Known Member Licensed User Longtime User Nov 7, 2018 #26 Whooaaa Steve... that's a great plan is it? hahahah
stevel05 Expert Licensed User Longtime User Nov 7, 2018 #27 ThRuST said: What bug are you talking about Click to expand... check the log window - Variable declaration type is missing in sub SetText
ThRuST said: What bug are you talking about Click to expand... check the log window - Variable declaration type is missing in sub SetText
ThRuST Well-Known Member Licensed User Longtime User Nov 7, 2018 #28 Oops sorry I totally missed that. Thanks for notifying me. I will update my post with v1.1
ThRuST Well-Known Member Licensed User Longtime User Nov 7, 2018 #30 Hi Steve. I updated my changes to v1.2 which should be the best yet.
ThRuST Well-Known Member Licensed User Longtime User Nov 7, 2018 #31 Hi again Steve, I couldn't let go of it. I updated your library to v1.3 See my post #19 to find it.
ThRuST Well-Known Member Licensed User Longtime User Nov 7, 2018 #32 Steve, it would be nice with a fading effect on the text everytime the button is clicked. How to do that
Steve, it would be nice with a fading effect on the text everytime the button is clicked. How to do that
ThRuST Well-Known Member Licensed User Longtime User Nov 7, 2018 #33 Steve, do you mind adding calls to these subs in your class. It will save me alot of time if you do it. Thanks Code: Public Sub FadeIn TSLbl.SetAlphaAnimated(mDuration /2, 1) End Sub Public Sub FadeOut TSLbl.SetAlphaAnimated(mDuration /2, 0) End Sub
Steve, do you mind adding calls to these subs in your class. It will save me alot of time if you do it. Thanks Code: Public Sub FadeIn TSLbl.SetAlphaAnimated(mDuration /2, 1) End Sub Public Sub FadeOut TSLbl.SetAlphaAnimated(mDuration /2, 0) End Sub
ThRuST Well-Known Member Licensed User Longtime User Nov 7, 2018 #34 oh, and they should better be private
V VittorioBarile Member Licensed User Jan 13, 2021 #35 Hi, I'm trying to use your lib on B4X Pages project. In my first page it works, but when i close it and open another B4XPage, it doens't show button switch: in my AppStart it works, but when i close this layout and open a new one it doesn't show button switch, but only text! Code: MainForm = Form1 MainForm.Stylesheets.Add(File.GetUri(File.DirAssets,"ToggleSwitch.css")) MainForm.Show Code: B4XPages.ShowPageAndRemovePreviousPages("NewPage") could you help me? Last edited: Jan 13, 2021
Hi, I'm trying to use your lib on B4X Pages project. In my first page it works, but when i close it and open another B4XPage, it doens't show button switch: in my AppStart it works, but when i close this layout and open a new one it doesn't show button switch, but only text! Code: MainForm = Form1 MainForm.Stylesheets.Add(File.GetUri(File.DirAssets,"ToggleSwitch.css")) MainForm.Show Code: B4XPages.ShowPageAndRemovePreviousPages("NewPage") could you help me?
stevel05 Expert Licensed User Longtime User Jan 23, 2021 #36 Sorry I somehow missed this post, did you get it fixed? If not post a project showing the problem.
stevel05 Expert Licensed User Longtime User Jan 23, 2021 #37 Just a thought, did you add the stylesheet to the form in the new page?