P positrom2 Active Member Licensed User Longtime User Jun 12, 2012 #1 Hallo, in a more lengthy code I want to use seekbar: Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean) startt=Value Label4.Text=startt Log(startt) DoEvents' (just for sure) End Sub Click to expand... Nothing happens when dragging the seekbar, no log, no update of Label4. What might be the reason? Regards, positrom2
Hallo, in a more lengthy code I want to use seekbar: Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean) startt=Value Label4.Text=startt Log(startt) DoEvents' (just for sure) End Sub Click to expand... Nothing happens when dragging the seekbar, no log, no update of Label4. What might be the reason? Regards, positrom2
walterf25 Expert Licensed User Longtime User Jun 12, 2012 #2 Seekbar It seems to work fine with me, how are you adding the seek-bar to your project, are you adding it diagrammatically or through the designer? cheers, Walter Upvote 0
Seekbar It seems to work fine with me, how are you adding the seek-bar to your project, are you adding it diagrammatically or through the designer? cheers, Walter
Erel B4X founder Staff member Licensed User Longtime User Jun 13, 2012 #3 If you added it with the designer then you should make sure not to call Initialize as it was already initialized by the designer. Upvote 0
If you added it with the designer then you should make sure not to call Initialize as it was already initialized by the designer.
P positrom2 Active Member Licensed User Longtime User Jun 13, 2012 #4 Thanks for the answers. Notably a simple seekbar example works, but not that in my more lenghty code. Seekbar was added by Designer and no initialize by code. I can push the bar and move it but nothing happens. Now I deleted seekbar1 in code and designer and added by designer a new one (seekbar2) -but same problem. I think seekbar was working since a few days ago and I was surprised that it fails by now. Could there be a relation with another issue I realized: I use B4A 1.92 and initially Designer showed me in Device details the device reolution. Now the field is empty. I am using Archos Internet Tablet70b (Android 3.2.1). But, since the simple test code works, that's probably a different issue. Thanks for help. Regards, positrom2 Upvote 0
Thanks for the answers. Notably a simple seekbar example works, but not that in my more lenghty code. Seekbar was added by Designer and no initialize by code. I can push the bar and move it but nothing happens. Now I deleted seekbar1 in code and designer and added by designer a new one (seekbar2) -but same problem. I think seekbar was working since a few days ago and I was surprised that it fails by now. Could there be a relation with another issue I realized: I use B4A 1.92 and initially Designer showed me in Device details the device reolution. Now the field is empty. I am using Archos Internet Tablet70b (Android 3.2.1). But, since the simple test code works, that's probably a different issue. Thanks for help. Regards, positrom2
Erel B4X founder Staff member Licensed User Longtime User Jun 13, 2012 #5 Put a breakpoint in the ValueChanged event and see if it is raised. Upvote 0
P positrom2 Active Member Licensed User Longtime User Jun 13, 2012 #6 It is not raised. Breakpoint is set in the sub seekbar2... using debug mode. Program isn't "breaked". thanks, positrom2 Upvote 0
It is not raised. Breakpoint is set in the sub seekbar2... using debug mode. Program isn't "breaked". thanks, positrom2
Erel B4X founder Staff member Licensed User Longtime User Jun 13, 2012 #7 Can you upload your project? Upvote 0
P positrom2 Active Member Licensed User Longtime User Jun 13, 2012 #8 May I send it by private mail? positrom2 Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jun 13, 2012 #9 I prefer not to go over private projects. Maybe you can create a small project that demonstrates this issue? Upvote 0
I prefer not to go over private projects. Maybe you can create a small project that demonstrates this issue?
P positrom2 Active Member Licensed User Longtime User Jun 13, 2012 #10 Will try. regards, positrom2 Upvote 0
P positrom2 Active Member Licensed User Longtime User Jun 13, 2012 #11 Erel, Tablet is connected via bluetooth to a µcontroller. Meanwhile I discovered the following: When I start the program with the µcontroller and bluetooth chip unpowered the seekbar2 does what it shall do (raising the event as seen by a breakpoint in the sub and by a change of label4.text). But when µcontroller and bluetooth chip are powered up, program runs but does nor respond to a seekbar2 change (no event raised). Thanks for help. regards, positrom2 Last edited: Jun 14, 2012 Upvote 0
Erel, Tablet is connected via bluetooth to a µcontroller. Meanwhile I discovered the following: When I start the program with the µcontroller and bluetooth chip unpowered the seekbar2 does what it shall do (raising the event as seen by a breakpoint in the sub and by a change of label4.text). But when µcontroller and bluetooth chip are powered up, program runs but does nor respond to a seekbar2 change (no event raised). Thanks for help. regards, positrom2
Erel B4X founder Staff member Licensed User Longtime User Jun 13, 2012 #12 First you should move all the UI code from outside of the If FirstTime = True block. Read the activities life cycle tutorial for more information. This code seems to create an endless loop: Code: Copy Sub Hauptschleife Dim unendlich As Boolean unendlich=True Do While unendlich zeichnen stress=(indexr-indexl)/2 Label3.Text=NumberFormat(stress,2,0)&" Dis" Loop End Sub Upvote 0
First you should move all the UI code from outside of the If FirstTime = True block. Read the activities life cycle tutorial for more information. This code seems to create an endless loop: Code: Copy Sub Hauptschleife Dim unendlich As Boolean unendlich=True Do While unendlich zeichnen stress=(indexr-indexl)/2 Label3.Text=NumberFormat(stress,2,0)&" Dis" Loop End Sub
P positrom2 Active Member Licensed User Longtime User Jun 13, 2012 #13 Erel, thanks for investigating my prog. This code seems to create an endless loop: Click to expand... That is the intention. The program shall loop endlessly, maybe for a day at least (when it were finished ultimately, my learning curve is more or less flat).... What else could be done to achieve an effective endless loop? I read somewhere it is forbidden, so somebody advised me for that trick. Read the activities life cycle tutorial Click to expand... There seems to be just one activity and the seekbar problem arises immediately (not after pausing or resuming). Notably in contrast to the seekbar problem the btnCls_Click event works. I don't see which guide from the lifecycle tutorial could help to get around that problem. Thanks for the help, regards positrom2 Upvote 0
Erel, thanks for investigating my prog. This code seems to create an endless loop: Click to expand... That is the intention. The program shall loop endlessly, maybe for a day at least (when it were finished ultimately, my learning curve is more or less flat).... What else could be done to achieve an effective endless loop? I read somewhere it is forbidden, so somebody advised me for that trick. Read the activities life cycle tutorial Click to expand... There seems to be just one activity and the seekbar problem arises immediately (not after pausing or resuming). Notably in contrast to the seekbar problem the btnCls_Click event works. I don't see which guide from the lifecycle tutorial could help to get around that problem. Thanks for the help, regards positrom2
Erel B4X founder Staff member Licensed User Longtime User Jun 14, 2012 #14 Endless loops are bad. They will not allow the main thread to process the messages queue properly. You should use a timer instead. Upvote 0
Endless loops are bad. They will not allow the main thread to process the messages queue properly. You should use a timer instead.
P positrom2 Active Member Licensed User Longtime User Jun 14, 2012 #15 Thank you Erel. Endless loops are bad. Click to expand... I will try with timer. Regards, positrom2 Upvote 0