Simple example for Sliding Panels

Beja

Expert
Licensed User
Longtime User
Hello friends,

I can't thank enough Klaus for posting a simpler verson of Erel's SlidingPanels example.. that answered my age-old question and now I put my hand off my head!.
Klaus forgot to implement Erel's last solution of making the panels' animation more smooth and with the touch movement. (in real time).

Any hint to do that? where in the code should I put Erel's few lines that made the panel movement according to the touch movement, and not after the touch as it is now?
Thanks in advance
 

Beja

Expert
Licensed User
Longtime User
hi Klaus,

not talking about another program.. couldn't locate it, bu I remember Erel put some code to link the panels movement with the touch movement.. now we are not moving the panels but we are giving them a gentle push and their animation then is automatic.
instead of automating the animation, can it follow the finger movement on the screen, like browsing the Apps and widgets in Android OS?.. if this can't be then it's ok, I can live with the auto animation.
Thanks again Klaus.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Hi Klaus,

Panel slides with touching the screen and moving the finger.. but Corwin42's example doesn't show in abstract designer and it is a pain in the neck for me to try to figure out so many views' co-ordinates and imagine where in the panel they are actually going to show. besides in Corwin42's example sliding is too fast.


http://www.b4x.com/forum/basic4andr...-sliding-panels-page-indicator.html#post67810
 
Last edited:
Upvote 0

Beja

Expert
Licensed User
Longtime User
Above I wrongly said Corwin42's animation example movement was jerky, in fact that was not true because I used it again and found out I moved the touch too fast. I forgot the crystal clock has a speed limit. sorry Corwin42!
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
The principle to add layouts defined in the Designer is the same as in the modified SlidingPanels program from Erel I posted in the other thread.
Attached corwin42s' modified program.

Best regards.
 

Attachments

  • BetterSlidingPanels_1.zip
    21.1 KB · Views: 660
Upvote 0

Beja

Expert
Licensed User
Longtime User
Thanks Klaus,
Running good!

Now testing, this code is running ok in a new test project, but when I added it to panel1 it is saying "Invalid destinationAddress"
Any meaning is helpful and appreciated.

B4X:
Sub Process_Globals
Dim Sms1 As PhoneSms
End Sub

Sub Globals
   Dim EditText1 As EditText
   Dim Button1 As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("Layout1")
End Sub
Sub Button1_Click
   Sms1.Send(EditText1.Text, "This is a test")
End Sub
 
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Beja .. all OK here ... Firefox

Talk about confused .. I thought i was replying to your other thread re virus ?
 
Last edited:
Upvote 0

Beja

Expert
Licensed User
Longtime User
Solved!

Thanks to Erel, Klaus Corwin42 and all wonderful friends who got out to help!

It was duplicate views with same names.. imagine that!

I learned one difference between vb and b4a today, that b4a is not forgiving any mistake or notifying you when you try to name two or more views with the same name, but it wouldn't forget that insult and will punish you later.
I created an EditText1 box in panel1 while there was already one with the same name in another panel.. when ran the app, I put a phone number in the one in panel1 while the other one was blank.. and that's where I got the error message with "Invalid Destination"
My debug method was that I hard-coded the number instead of referencing EditText1, and it worked, so I followed the thread from there.

new lesson: depend on yourself!

Now got to go to work!.. thanks guys..
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Also discovered one interesting thing.. if you have multiple panels and want to put a button on each (to do the same thing), then all what you need to do is give all the buttons the same name and dim the first one only and write the click event for it. This is not an array. I am no sure if this is good coding practice or problematic in the future, but it works.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
This can be done even with Buttons having different names.
The important point here is that the EventName is the same !
In your case you set a same name in the Designer and by default the event name is the same as the view name.
In your case as you don't make any reference to the buttons in your code you could ommit the Dim.
But if you make a reference to the button you dimed, the system will refer to the last button that was added and not to the others.
In the event routine you can know what button raised the event with the Sender keyword checking the buttons Tag property.
You could have a look at SecondProgram in the Beginner's Guide there are several buttons with different names and the same event routine.

Best regards.
 
Upvote 0

shana

New Member
Sir,

I'm still new in Basic4android. I saw your file you uploaded here (BetterSlidingPanels_1.zip). I'm wondering, instead of color, is it ok if I put an image there, e.g. the size of the image is 550x850 ? So I can make it like an e-book. Thanks.
 
Upvote 0

shana

New Member
Sir,

I have another question, how about if there’s a button, then if you click it, only there will appear the panels.

Sorry for my english. I hope you understand my question. Thank you.
 
Upvote 0
Top