spelling game app need help please.

evilkiwi

Member
Licensed User
Longtime User
Is anyone familiar with the 4 pics 1 word app and how you touch the letter and it automatically goes to the correct place of the word you are trying to guess. I am trying to do something similar for a spelling game for my little girl but have know clue where to start. Can anyone point me in the right direction to get me started. Thanks.:sign0085:
 

evilkiwi

Member
Licensed User
Longtime User
got labels moving

I managed to drag my labels around the screen, now im having trouble getting them to lock into place. Here is the code im using to get the labels to drag around the screen.

Level 1 activity:

Sub Globals
Dim btnenter As Button
Dim btnnext As Button
Dim btnexit As Button
Dim imgpic As ImageView
Dim lblletter As Label
Dim lblletter2 As Label
Dim lblletter3 As Label
Dim lblrandom As Label
Dim lblrandom2 As Label
Dim lblrandom3 As Label
Dim lblrandom4 As Label
Dim lblrandom5 As Label


End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("level1")

Dim dv1, dv2, dv3, dv4, dv5 As dragging
dv1.Initialize(Activity, lblrandom)
dv2.Initialize(Activity, lblrandom2)
dv3.Initialize(Activity, lblrandom3)
dv4.Initialize(Activity, lblrandom4)
dv5.Initialize(Activity, lblrandom5)











End Sub


Dragging class:
Sub Class_Globals
Private innerview As View
Private lblletter As Label
Private lblletter2 As Label
Private lblletter3 As Label
Private lblrandom As Label
Private lblrandom2 As Label
Private lblrandom3 As Label
Private lblrandom4 As Label
Private lblrandom5 As Label
Private downx, downy As Int
Private ACTION_DOWN, ACTION_MOVE, ACTION_UP As Int


End Sub


Public Sub Initialize(Activity As Activity, v As View)
innerview = v
lblrandom.Initialize("")
'pnl1.Color = Colors.Transparent
Activity.AddView(lblrandom, v.Left, v.Top, v.Width, v.Height)
ACTION_DOWN = Activity.ACTION_DOWN
ACTION_MOVE = Activity.ACTION_MOVE
ACTION_UP = Activity.ACTION_UP
Dim r As Reflector
r.Target = lblrandom
r.SetOnTouchListener("lblrandom_Touch")


innerview = v
lblrandom2.Initialize("")
Activity.AddView(lblrandom2, v.Left, v.Top, v.Width, v.Height)
ACTION_DOWN = Activity.ACTION_DOWN
ACTION_MOVE = Activity.ACTION_MOVE
ACTION_UP = Activity.ACTION_UP
Dim r As Reflector
r.Target = lblrandom2
r.SetOnTouchListener("lblrandom2_Touch")

innerview = v
lblrandom3.Initialize("")
Activity.AddView(lblrandom3, v.Left, v.Top, v.Width, v.Height)
ACTION_DOWN = Activity.ACTION_DOWN
ACTION_MOVE = Activity.ACTION_MOVE
ACTION_UP = Activity.ACTION_UP
Dim r As Reflector
r.Target = lblrandom3
r.SetOnTouchListener("lblrandom3_Touch")

innerview = v
lblrandom4.Initialize("")
Activity.AddView(lblrandom4, v.Left, v.Top, v.Width, v.Height)
ACTION_DOWN = Activity.ACTION_DOWN
ACTION_MOVE = Activity.ACTION_MOVE
ACTION_UP = Activity.ACTION_UP
Dim r As Reflector
r.Target = lblrandom4
r.SetOnTouchListener("lblrandom4_Touch")

innerview = v
lblrandom5.Initialize("")
Activity.AddView(lblrandom5, v.Left, v.Top, v.Width, v.Height)
ACTION_DOWN = Activity.ACTION_DOWN
ACTION_MOVE = Activity.ACTION_MOVE
ACTION_UP = Activity.ACTION_UP
Dim r As Reflector
r.Target = lblrandom5
r.SetOnTouchListener("lblrandom5_Touch")

End Sub



Private Sub lblrandom_Touch (o As Object, ACTION As Int, x As Float, y As Float, motion As Object) As Boolean
If ACTION = ACTION_DOWN Then
downx = x
downy = y

Else
Log("not down")
innerview.Left = innerview.Left + x - downx
innerview.Top = innerview.Top + y - downy
lblrandom.Left = innerview.Left
lblrandom.Top = innerview.Top

End If
Return True

End Sub

Private Sub lblrandom2_Touch (o As Object, ACTION As Int, x As Float, y As Float, motion As Object) As Boolean
If ACTION = ACTION_DOWN Then
downx = x
downy = y
Log("2 down")
Else
innerview.Left = innerview.Left + x - downx
innerview.Top = innerview.Top + y - downy
lblrandom2.Left = innerview.Left
lblrandom2.Top = innerview.Top
End If
Return True
End Sub

Private Sub lblrandom3_Touch (o As Object, ACTION As Int, x As Float, y As Float, motion As Object) As Boolean
If ACTION = ACTION_DOWN Then
downx = x
downy = y
Log("3 down")
Else
innerview.Left = innerview.Left + x - downx
innerview.Top = innerview.Top + y - downy
lblrandom3.Left = innerview.Left
lblrandom3.Top = innerview.Top
End If
Return True
End Sub

Private Sub lblrandom4_Touch (o As Object, ACTION As Int, x As Float, y As Float, motion As Object) As Boolean
If ACTION = ACTION_DOWN Then
downx = x
downy = y
Log("4 down")
Else
innerview.Left = innerview.Left + x - downx
innerview.Top = innerview.Top + y - downy
lblrandom4.Left = innerview.Left
lblrandom4.Top = innerview.Top
End If
Return True
End Sub

Private Sub lblrandom5_Touch (o As Object, ACTION As Int, x As Float, y As Float, motion As Object) As Boolean
If ACTION = ACTION_DOWN Then
downx = x
downy = y
Log(motion)
Log("5 down")
lblrandom5.Top = 10
lblrandom5.Left = 5
lblrandom5.Text = "5"

'
' Else
' innerview.Left = innerview.Left + x - downx
' innerview.Top = innerview.Top + y - downy
' lblrandom5.Left = innerview.Left
' lblrandom5.Top = innerview.Top
'

End If
Return True
End Sub

I have tried lblrandom.Top = 460 ect and lblrandom.Left = 230 ect but with no luck, no matter where i place it it doesnt effect the labels. Where am i going wrong? Any ideas?:sign0163:
 
Upvote 0

evilkiwi

Member
Licensed User
Longtime User
Thanks

Thanks for the replies. Im already using the draggableview class and got nowhere. The floating windows looks like exactly what i need. thanks so much. Will update if i can get it to work. :D
 
Upvote 0

evilkiwi

Member
Licensed User
Longtime User
another panel

Thanks for the code it is exactly what im looking for. 1 question(well 2 actually:)), it is possible to add another panel to drag and dock? I see you are not using a designer, what part of the code would i use to add another panel. Sorry about the dumb questions im still learning the ropes.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Thanks for the code it is exactly what im looking for. 1 question(well 2 actually:)), it is possible to add another panel to drag and dock? I see you are not using a designer, what part of the code would i use to add another panel. Sorry about the dumb questions im still learning the ropes.

In the demo #2, "Win" is the floating window. If you want to add another floating window, create another object like Win.
 
Upvote 0

evilkiwi

Member
Licensed User
Longtime User
did that.

Thanks for the reply. I did manage to add another window, but what i'm having trouble with is getting it to dock to a panel. It will move around great but will not dock, like the original window.
 
Upvote 0

evilkiwi

Member
Licensed User
Longtime User
That worked

Thanks. I got the other window to dock nicely. I do have another question for you. I am using a designer for the app i'm trying to make. Is it possible to make the floating windows using a designer? I am using labels that i need to dock. I will add a zip file of what i have so far. If you could take a look and give me your advice, that would be awesome. Follow the link.

http://tracee.dualzdesigns.com/spelling game.zip

sorry i couldn't add a zip file, couldn't compress it down enough.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Thanks. I got the other window to dock nicely. I do have another question for you. I am using a designer for the app i'm trying to make. Is it possible to make the floating windows using a designer? I am using labels that i need to dock. I will add a zip file of what i have so far. If you could take a look and give me your advice, that would be awesome. Follow the link.

http://tracee.dualzdesigns.com/spelling game.zip

sorry i couldn't add a zip file, couldn't compress it down enough.

Unfortunately I don't have enough time to delve into your code.
About the designer, you can place panels in the designer and, later on, replace them by your floating windows (they are panels).
 
Upvote 0
Top