Italian Menu grafico

udg

Expert
Licensed User
Longtime User
Posso offrire la pulizia del cesso per un anno
Potrebbe essere interessante..
Lo sapete che a Lugano si pagano 25CHF/ora per le pulizie? E spostandosi verso Zurigo le tariffe aumentano...
Ora la domanda è: conviene scrivere l'app o infilarsi i guanti di gomma e andare a pulire cessi?
 

Star-Dust

Expert
Licensed User
Longtime User
La seconda che hai detto.... il lavoro manuale io lo considero superiore a quello mentale... quindi tutti meritati....
25 chf corrispondono? Cercano qualcuno a Zurigo? Esperienza pluriennale
 

udg

Expert
Licensed User
Longtime User
Ad oggi 25CHF sono circa 25 euro. A Zurigo hanno stipendi almeno doppi che a Lugano quindi credo che anche le pulizie se non il doppio..
 

LucaMs

Expert
Licensed User
Longtime User
Ora la domanda è: conviene scrivere l'app o infilarsi i guanti di gomma e andare a pulire cessi?
O imbrocchi l'app perfetta che ti consenta di incassare almeno un milione di euro, oppure conviene qualunque altro tipo di lavoro.
Questo però economicamente; perché fatica e nel caso citato disgusto, sono molto maggiori in altri lavori.
 

Star-Dust

Expert
Licensed User
Longtime User
Anni di studio sprecati... potevo fare i soldi senza dover pensare al marketing, linguaggi, compatibilità, versioni, portabilità, dispositivi, dimensione schermo....
 

Star-Dust

Expert
Licensed User
Longtime User
Scusate:p, torno su chiaccericci
 

ken87

Active Member
Licensed User
Longtime User
Ciao sono riuscito a far girare il codice postato che aveva due cose da sistemare
B4X:
For indice_lista = 0 to List1.Size-1
   dim row as int = indice_lista / 3
   dim cell as int = (indice_list mod 3 )
   'se è la prima cella di una riga, crea la riga. altrimenti la richiama per riempire le celle numero 2 e 3
   Dim rowpnl As Panel
   if cell = 0 then
      'load the 3 panels layout to fill each clv's row.
      rowpnl.Initialize("")
      rowpnl.LoadLayout("lytGridRow")
   else
      rowpnl = clv1.getPanel(row)
   end if
   Dim bckpnl As Panel = rowpnl.GetView(0) 'layout has a backpanel as its foundation
   'Compila i vari campi della cella
   Dim cellpnl As Panel = bckpnl.getview(cell)
   cellpnl.LoadLayout("lytCell")
   Dim bckp AsPanel = cellpnl.GetView(0) 'pannellino di base della singola cella
   Dim image As ImageView = bckp.GetView(0) 'image view
   image.Bitmap = LoadBitmapSample(File.DirAssets,"pizza.png",bckp.Width, bckp.Height/2)
   Dim title AsLabel = bckp.GetView(1) 'title
   title.Text = List1.Get(indice_lista)
   Dim Stitle As Label = bckp.GetView(2) 'subtitle
   Stitle.Text = "mozarella"'
   Dim Prezzo As Label = bckp.GetView(3) 'nuova label posta dopo immagine, title e subtitle
   Prezzo.Text ="8 euro"
   'Aggiorna la riga della clv oppure inseriscine una nuova
   if cell <> 0 then
     clvGrid.ReplaceAt(row, rowpnl, cellheight, row)
   else
     clvGrid.Add(rowpnl, cellheight, row) 'add the Row Panel to the CLV
  end if
next
Il problema che compila la terza cella in modo corretto ma lasicia le prime due vuote

Grazie dell'aiuto cercherò di contraccambiare
 

Attachments

  • tre.jpg
    tre.jpg
    155.6 KB · Views: 219
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Purtroppo non ho seguito la cosa dall'inizio, non posso aiutarti.
 

udg

Expert
Licensed User
Longtime User
Ciao sono riuscito a far girare il codice postato che aveva due cose da sistemare.
Il problema che compila la terza cella in modo corretto ma lasicia le prime due vuote

Non capisco se vuol dire che hai risolto correggendo un paio di errori o se, pur girando tutto senza errori, ti ritrovi solo con la terza cella di ogni riga valorizzata.
 

ken87

Active Member
Licensed User
Longtime User
Al tuo sorgente ho aggiunto questo dopo endi if
B4X:
rowpnl.Initialize("")
rowpnl.LoadLayout("lytGridRow")

Il codice non da errori ma la prima cella resta color ciano la seconda di colore arancione chiaro , metre la terza mette foto titolo come dovrebbe essere vedi allegato
quindi ecco il sorgente:

B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
End Sub

Sub Globals
    Dim cont As Int
    cont = 0
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private clvGrid As CustomListView150
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("lytGrid")
    MakeGrid
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub MakeGrid

    Dim List1 As List
    List1.Initialize
    List1.Add("Pizza margherita")
    List1.Add("Pizza wurstel")
    List1.Add("Pizza sarda")

    List1.Add("Pizza olive")
    List1.Add("Pizza rossa")
    List1.Add("Pizza frutti di mare")

    List1.Add("Pizzza svedese")
    List1.Add("Pizza salsiccia secca")
    List1.Add("Pizza rossa")

    List1.Add("Pizza 10")
    List1.Add("Pizzza 11")
    List1.Add("Pizza 12")

    List1.Add("Pizza 13")
    List1.Add("Pizzza 14")
    List1.Add("Pizza 15")

    List1.Add("Pizza 16")
    List1.Add("Pizzza 17")
    List1.Add("Pizza 18")


    Dim cellheight As Int = (clvGrid.asview.width - 4dip) /3
    'Repeat for as many records you have to display in the CLV. Note: I set it to 5 just to fill a bit the CLV.

    For indice_lista = 0 To List1.Size-1
        Dim row As Int = indice_lista / 3
        Dim cell As Int = (indice_lista Mod 3 )
  
        'load the 3 panels layout to fill each clv's row.
        Dim rowpnl As Panel
        If cell = 0 Then

        rowpnl.Initialize("")
        rowpnl.LoadLayout("lytGridRow")
        Else
            rowpnl = clvGrid.getPanel(row)
        End If

        Dim bckpnl As Panel  = rowpnl.GetView(0)    'layout has a backpanel as itd foundation
  
        'load the 3 panels layout to fill each clv's row.
        Dim rowpnl As Panel
        rowpnl.Initialize("")
        rowpnl.LoadLayout("lytGridRow")
        Dim bckpnl As Panel  = rowpnl.GetView(0)    'layout has a backpanel as itd foundation
  
        'Left cell panel
        Log ("cell : " & cell)
        Dim cellpnl As Panel = bckpnl.getview(cell) 'left cell
        cellpnl.LoadLayout("lytCell")
        'we should load DB data in cellpnl's items, but here we don't so nothing is shown
  
        Dim bckp As Panel = cellpnl.GetView(0)
        Dim image As ImageView = bckp.GetView(0)    'image view
        image.Bitmap = LoadBitmapSample(File.DirAssets,"pizza.png",bckp.Width, bckp.Height/2)
        Dim title As Label = bckp.GetView(1)        'title
        title.Text = List1.Get(indice_lista)
        Dim Stitle As Label = bckp.GetView(2)        'subtitle
        Stitle.Text = "mozarella"
        'Dim Prezzo As Label = bckp.GetView(3) 'nuova label posta dopo immagine, title e subtitle
        'Prezzo.Text ="8 euro"
        If cell <> 0 Then
            clvGrid.ReplaceAt(row, rowpnl, cellheight, row)
        Else
            clvGrid.Add(rowpnl, cellheight, row) 'add the Row Panel to the CLV
  
        Log (cont)
        Log (cell)
        cont = cont +1
        Log (cont)
        End If
    Next


End Sub


Sub ivIncr_Click
    Dim iv As ImageView = Sender
    Dim row As Int =clvGrid.GetItemFromView(iv)
    Dim rowpnl As Panel = clvGrid.GetPanel(row)
    Dim bckpnl As Panel  = rowpnl.GetView(0)        'layout has a backpanel as its foundation
    For i = 0 To bckpnl.NumberOfViews - 1
        Dim cellpnl As Panel = bckpnl.GetView(i)
        Dim bckp As Panel = cellpnl.GetView(0)
        Dim iv1 As ImageView = bckp.GetView(5)        'increment icon
        If iv1 = Sender Then
            Dim lblqty As Label = bckp.GetView(4)    'label for quantity
            Dim qty As Int = lblqty.Text
            qty = qty + 1
            lblqty.Text = qty
            Exit
        End If
    Next
End Sub

Sub ivDecr_Click
    Dim iv As ImageView = Sender
    Dim row As Int =clvGrid.GetItemFromView(iv)
    Dim rowpnl As Panel = clvGrid.GetPanel(row)
    Dim bckpnl As Panel  = rowpnl.GetView(0)        'layout has a backpanel as its foundation
    For i = 0 To bckpnl.NumberOfViews - 1
        Dim cellpnl As Panel = bckpnl.GetView(i)
        Dim bckp As Panel = cellpnl.GetView(0)
        Dim iv1 As ImageView = bckp.GetView(3)        'decrement icon
        If iv1 = Sender Then
            Dim lblqty As Label = bckp.GetView(4)    'label for quantity
            Dim qty As Int = lblqty.Text
            qty = qty - 1
            If qty < 0 Then qty = 0
            lblqty.Text = qty
            Exit
        End If
    Next
End Sub
 

Attachments

  • inv.jpg
    inv.jpg
    180.4 KB · Views: 198
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
il problema dovrebbe essere nella sub MakeGrid

vedi questo punto ad esempio
B4X:
        If cell = 0 Then

            rowpnl.Initialize("")
            rowpnl.LoadLayout("lytGridRow")
        Else
            rowpnl = clvGrid.getPanel(row)
        End If

Sembra che lo stesso pannello che carichi con il LoadLayout , ogni volta che fai un LoaydLayout lo sposta nel successivo pannello, non lo duplica nel successivo e poi viene aggiornato con gli elementi nuovi. Anziche usare il LoadLayout prova a crearli da codice gli elementi, io in effetti non avrei usato questo sistema.

Però scusami se te lo dico Ken, tutto il codice sembra troppo confusionario. :p
 

udg

Expert
Licensed User
Longtime User
E' proprio a causa della tua aggiunta che non può più funzionare come previsto.
Pur essendo del codice improvvisato direttamente nel post e quindi non testato, la logica era che il pannello della CLV (quello che contiene 3 celle) viene inizializzato quando bisogna inserire la cella di sinistra, mentre negli altri due casi viene semplicemente richiamato perchè già esistente.
 

udg

Expert
Licensed User
Longtime User
Prova ad eseguire il progetto che ti allego qui, senza modifiche.
Al di là degli adattamenti grafici certamente necessari, la logica di costruzione della griglia funziona correttamente.
Aggiungi altre tipologie di pizza per vedere come il tutto si adatta automaticamente.

udg
 

Attachments

  • pizzeria.zip
    123.8 KB · Views: 205
Top