Hi Erel,
Basically I want to see the result of a selected item from a spinner,
a text input and images from panel1 to another panel2.
For example, on the 3th image above you see the text(view) 'this is a test' on panel1.
On the 4th image displaying it correctly again, but in the other panel2.
So I want to have the same behaviour for other views on panel1, but didn't work at all.
My spinners have visibility features, meaning spinners will be visible or invisible, depending
of the item that you choose from a spinner.
And that selected item I want to see in another panel to show.
For people who wants to see the codes, here it is:
'Main' module:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim cc As ContentChooser
Dim SelectionIndex As Int
Dim ImageDir, ImageFileName As String
Dim Selection As String
Dim Input As String
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Panel1 As Panel
Dim edtText As EditText
Dim AddAll As String
Dim SpActivities As Spinner
Dim SpConcerts As Spinner
Dim SpCulinair As Spinner
Dim SpHistory As Spinner
Dim SpOther As Spinner
Dim SpSports As Spinner
Dim SpTheatre As Spinner
Dim SpRegion As Spinner
Dim Selector As Map 'Added a map - see below
Dim btOk As Button
Dim ivFoto1 As ImageView
Dim ivFoto2 As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("croatiamenu.bal")
cc.Initialize ("chooser")
SpConcerts.Visible = False
SpCulinair.Visible = False
SpHistory.Visible = False
SpSports.Visible = False
SpTheatre.Visible = False
SpOther.Visible = False
' There seemed to be no reason in having the lists other than to add the data to the spinners, so I removed
' them and replaced the code
SpRegion.AddAll (Array As String ("Region", "Banovina", "Baranja", "Dalmatia", "Gorski kotar", "Istria", "Konavle", "Kordun", "Lika"))
SpActivities.AddAll (Array As String ("Activities", "Concerts", "Culinair", "History", "Sports", "Theatre", "Other"))
SpConcerts.AddAll (Array As String ("Concerts", "Classic", "Folklore", "Jazz", "Latin", "Pop", "Rock", "Other"))
SpCulinair.AddAll (Array As String ("Culinair", "African", "Asian", "Croatian", "French", "Italian", "Latin", "Other"))
SpHistory.AddAll (Array As String ("History", "Castles", "Church", "European", "Museum", "Other"))
SpSports.AddAll (Array As String ("Sports", "Beach", "Cycling", "Soccer", "Swimming", "Tennis", "Wheels", "Other"))
SpTheatre.AddAll (Array As String ("Theatre", "Opera", "Ballet", "Circus", "Comedy", "Kids", "Modern Play", "Other"))
SpOther.AddAll (Array As String ("Other", "Nature", "Banks", "Hospital", "Comedy", "Police", "Other"))
Selector.Initialize ' this map holds the text that triggers a spinner to become visible as the key
Selector.Put ("Activities", spActivities) ' and the spinner it relates to as the data
Selector.Put ("Concerts", spConcerts) ' this can be extended easily
Selector.Put ("Culinair", spCulinair) ' see spActivities_ItemClick for use
Selector.Put ("History", spHistory)
Selector.Put ("Sports", spSports)
Selector.Put ("Theatre",spTheatre)
Selector.Put ("Other", spOther)
End Sub
Sub chooser_Result (Success As Boolean, Dir As String, FileName As String)
ImageDir = Dir
ImageFileName = FileName
If Success Then ivFoto1.Bitmap = (LoadBitmapSample(Dir, FileName, 150, 150))
If Success Then ivFoto2.Bitmap = (LoadBitmapSample(Dir, FileName, 150, 150))
End Sub
Sub Activity_Resume
'Array As String
'SpRegion.AddAll(lt1)
'Map = Selector.SelectedItem
'Selection = SpRegion.SelectedItem
edtText.Text = Input
If ImageDir<>"" Then ivFoto1.Bitmap = (LoadBitmapSample(ImageDir, ImageFileName, 150, 150))
If ImageDir<>"" Then ivFoto2.Bitmap = (LoadBitmapSample(ImageDir, ImageFileName, 150, 150))
End Sub
Sub Activity_Pause (UserClosed As Boolean)
Input = edtText.Text
End Sub
Sub Region_ItemClick (Position As Int, Value As Object)
End Sub
Sub Music_ItemClick (Position As Int, Value As Object)
End Sub
Sub edtText_TextChanged (Old As String, New As String)
End Sub
Sub edtText_EnterPressed
End Sub
Sub edtText_FocusChanged (HasFocus As Boolean)
End Sub
Sub Activities_ItemClick (Position As Int, Value As Object)
End Sub
Sub Theatre_ItemClick (Position As Int, Value As Object)
End Sub
Sub Sports_ItemClick (Position As Int, Value As Object)
End Sub
Sub Other_ItemClick (Position As Int, Value As Object)
End Sub
Sub History_ItemClick (Position As Int, Value As Object)
End Sub
Sub Culinair_ItemClick (Position As Int, Value As Object)
End Sub
Sub Concerts_ItemClick (Position As Int, Value As Object)
End Sub
Sub SpActivities_ItemClick (Position As Int, Value As Object)
' removed the flags for Concerts etc as you can get the information from the spConcerts.Visible etc
' also added a different way of revealing the next spinner. This way is easily extensible and needs less code
Dim spTemp As Spinner
spTemp = Selector.Get (Value) ' the value selected is looked up on the map, and the pointer to its associated
' spinner is stored in spTemp
SpConcerts.Visible = False
SpCulinair.Visible = False
SpHistory.Visible = False
SpSports.Visible = False
SpTheatre.Visible = False
SpOther.Visible = False
spTemp.Visible = True ' now we can set spTemp to visible (as it is a pointer to the original spinner)
' it will make the original visible
End Sub
Sub SpTheatre_ItemClick (Position As Int, Value As Object)
End Sub
Sub SpSports_ItemClick (Position As Int, Value As Object)
End Sub
Sub SpRegion_ItemClick (Position As Int, Value As Object)
Selection = Value
SelectionIndex = Position
End Sub
Sub SpOther_ItemClick (Position As Int, Value As Object)
End Sub
Sub SpHistory_ItemClick (Position As Int, Value As Object)
End Sub
Sub SpCulinair_ItemClick (Position As Int, Value As Object)
End Sub
Sub SpConcerts_ItemClick (Position As Int, Value As Object)
End Sub
Sub ivFoto1_Click
cc.Show("image/*", "Choose image")
ImageViewTemp = ivFoto1
End Sub
Sub btOk_Click
StartActivity("preview")
End Sub
Sub ivFoto2_Click
cc.Show("image/*", "Choose image")
ImageViewTemp = ivFoto2
End Sub
'preview'module:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim result As String
result = ""
Dim AddAll As List
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim btSave As Button
Dim ivFoto3 As ImageView
Dim lbActivities As Label
Dim lbOther As Label
Dim lbRegion As Label
Dim lbText As Label
Dim ivFoto4 As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("preview")
End Sub
Sub Activity_Resume
lbText.Text = "You choose : " & Main.Input
'lbActivities.Text = "You choose : " & Main.AddAll.Get(Main.SelectionIndex)
'lbOther.Text = "You choose : " & Main.AddAllGet(Main.SelectionIndex)
'lbRegion.Text = "You choose : " & Main.Get(Main.SelectionIndex)
If Main.ImageDir<>"" Then ivFoto3.Bitmap = (LoadBitmapSample(Main.ImageDir, Main.ImageFileName, 100, 100))
If Main.ImageDir<>"" Then ivFoto4.Bitmap = (LoadBitmapSample(Main.ImageDir, Main.ImageFileName, 100, 100))
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btSave_Click
End Sub