Android Question Edit Text Problem.

Discussion in 'Android Questions' started by Sreenadh OG, Jan 29, 2015.

  1. Sreenadh OG

    Sreenadh OG Member Licensed User

    Hi All,
    I have a panel contain some EditText and Lable, But i cant enter text in EditText, I am using given code ..

    Code:
    '    PnlDialogAccCmp.AddView(LblDialogAccName,10,0,60,18)
    '    PnlDialogAccCmp.AddView(EditDlgAcusedName,60,0,120,28)
    '    PnlDialogAccCmp.AddView(LblDialogAccPh,10,43,60,18) 
    '    PnlDialogAccCmp.AddView(EditDlgAccPh,60,40,120,28) 
    '    PnlDialogAccCmp.AddView(LvDialogAccPerson,10,65,190,70) 
    '    CstmDigAddAcdNewPesrn.AddView(PnlDialogAccCmp,10,0, 77%x, 60%y )
    '    

    'I cant enter text in EditDlgAccPh ,But the code given above works properly
        PnlDialogAccCmp.AddView(LblDialogAccName,5%x,0%x,30%x,10%x)
        PnlDialogAccCmp.AddView(EditDlgAcusedName,
    25%x,0%x,43%x,12%x)
        PnlDialogAccCmp.AddView(LblDialogAccPh,
    5%x,18%x,30%x,10%x)
        PnlDialogAccCmp.AddView(EditDlgAccPh,
    25%x,18%x,43%x,12%x)
        PnlDialogAccCmp.AddView(LvDialogAccPerson,
    5%x,19%x,80%x,50%x
        CstmDigAddAcdNewPesrn.AddView(PnlDialogAccCmp,
    10,077%x60%y )
     
  2. sorex

    sorex Expert Licensed User

    where's the rest of the code?
     
  3. Sreenadh OG

    Sreenadh OG Member Licensed User

    Code:
    Sub BtnAddAccusedNew_Click
    Dim CstmDigAddAcdNewPesrn As CustomDialog
    Dim EditDlgAcusedName As EditText     
        
    Dim EditDlgAccPh As EditText
        
    Dim LblDialogAccName As Label
        
    Dim LblDialogAccPh As Label
        
    Dim PnlDialogAccCmp As Panel
        
    Dim LvDialogAccPerson As ListView
        
    Dim BmpDialogAddPersn As Bitmap
        LvDialogAccPerson.Initialize(
    "LvDialogAccPerson")
        
    If Acc > 0 Then
            
    For NoAcused=0 To RangeForAcused-1
                LvDialogAccPerson.AddSingleLine(AccusedStrName(NoAcused)&
    "  "&AccusedPh(NoAcused))
            
    Next
        
    End If
        EditDlgAcusedName.Initialize(
    "EditDlgAcusedName")
        EditDlgAccPh.Initialize(
    "EditDlgAccPh"
        EditDlgAcusedName.InputType=EditDlgAcusedName.INPUT_TYPE_NONE   
        EditDlgAccPh.InputType=EditDlgAccPh.INPUT_TYPE_PHONE  
        LblDialogAccPh.Initialize(
    "LblDialogAccPh")
        LblDialogAccName.Initialize(
    "LblDialogAccName")
        PnlDialogAccCmp.Initialize(
    "Panel1")
        LblDialogAccName.Text=
    "Name"
        LblDialogAccName.TextColor=
    Colors.White 
        LblDialogAccName.TextSize=
    20
        LblDialogAccPh.Text=
    "Phone" 
        LblDialogAccPh.TextColor=
    Colors.White 
        LblDialogAccPh.TextSize=
    20 

    '    PnlDialogAccCmp.AddView(LblDialogAccName,10,0,60,18)
    '    PnlDialogAccCmp.AddView(EditDlgAcusedName,60,0,120,28)
    '    PnlDialogAccCmp.AddView(LblDialogAccPh,10,43,60,18) 
    '    PnlDialogAccCmp.AddView(EditDlgAccPh,60,40,120,28) 
    '    PnlDialogAccCmp.AddView(LvDialogAccPerson,10,65,190,70) 
    '    CstmDigAddAcdNewPesrn.AddView(PnlDialogAccCmp,10,0, 77%x, 60%y )
    '   
        PnlDialogAccCmp.AddView(LblDialogAccName,5%x,0%x,30%x,10%x)
        PnlDialogAccCmp.AddView(EditDlgAcusedName,
    25%x,0%x,43%x,12%x)
        PnlDialogAccCmp.AddView(LblDialogAccPh,
    5%x,18%x,30%x,10%x)
        PnlDialogAccCmp.AddView(EditDlgAccPh,
    25%x,18%x,43%x,12%x)
        PnlDialogAccCmp.AddView(LvDialogAccPerson,
    5%x,19%x,80%x,50%x
        CstmDigAddAcdNewPesrn.AddView(PnlDialogAccCmp,
    10,077%x60%y 
       
        BmpDialogAddPersn.Initialize(
    File.DirAssets,"AddNewPerson.png"
        ret = CstmDigAddAcdNewPesrn.Show(
    "Add Contact""Add""Cancel","" , BmpDialogAddPersn)
        
    If EditDlgAcusedName.Text <>"" AND EditDlgAccPh.Text <>"" Then  
            AccusedStrName(NoAcused)=EditDlgAcusedName.Text
            AccusedPh(NoAcused)=EditDlgAccPh.Text    
            LvDialogAccPerson.AddSingleLine(AccusedStrName(NoAcused)&
    "   "&AccusedPh(NoAcused))
            NoAcused=NoAcused+
    1
            RangeForAcused = NoAcused
            Acc=Acc+
    1
        
    End If
    ScrollInitializeNewCase
    End Sub
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Don't use a modal dialog for this. Just show the panel in front of all the other views.
     
    Sreenadh OG likes this.
  5. Sreenadh OG

    Sreenadh OG Member Licensed User

    But i can enter a text in first Edittext and i can also edit both Edittext without using percentage..How it is possible?
     
  6. Sreenadh OG

    Sreenadh OG Member Licensed User

    hai,
    Now i am using panel in front of all the other views, but i didn't get text from EditText. How can i get the text from EditText ?
    My code is ..
    Code:
    Sub Globals
        
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.
       
        
    Dim LvDialogAccPerson As ListView
        
    Private Panel1 As Panel
        
    Private Button1 As Button
        
    Private BtnAddPersnAccused As Button
        
    Private BtnCancelPersonAccused As Button
        
    Private EditDlgAccPh As EditText
        
    Private EditDlgAcusedName As EditText
        
    Private LblDialogAccName As Label
        
    Private LblDialogAccPh As Label
        
    Private PnlDialogAccCmp As Panel
        
    Private EditText1 As EditText
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
       
        
    Activity.LoadLayout("La")
       
        
    Dim BmpDialogAddPersn As Bitmap
        LvDialogAccPerson.Initialize(
    "LvDialogAccPerson")
       
        EditDlgAcusedName.Initialize(
    "EditDlgAcusedName")
        EditDlgAccPh.Initialize(
    "EditDlgAccPh"
        EditDlgAcusedName.InputType=EditDlgAcusedName.INPUT_TYPE_NONE   
        EditDlgAccPh.InputType=EditDlgAccPh.INPUT_TYPE_PHONE  
        LblDialogAccPh.Initialize(
    "LblDialogAccPh")
        LblDialogAccName.Initialize(
    "LblDialogAccName")
        PnlDialogAccCmp.Initialize(
    "PnlDialogAccCmp")
        LblDialogAccName.Text=
    "Name"
        LblDialogAccName.TextColor=
    Colors.White 
        LblDialogAccName.TextSize=
    20
        LblDialogAccPh.Text=
    "Phone" 
        LblDialogAccPh.TextColor=
    Colors.White 
        LblDialogAccPh.TextSize=
    20 
        BtnAddPersnAccused.Initialize(
    "BtnAddPersnAccused"
        BtnCancelPersonAccused.Initialize(
    "BtnCancelPersonAccused")
       


        PnlDialogAccCmp.AddView(LblDialogAccName,
    5%x,0%x,30%x,10%x)
        PnlDialogAccCmp.AddView(EditDlgAcusedName,
    25%x,0%x,43%x,12%x)
        PnlDialogAccCmp.AddView(LblDialogAccPh,
    5%x,18%x,30%x,10%x)
        PnlDialogAccCmp.AddView(EditDlgAccPh,
    25%x,18%x,43%x,12%x)
        PnlDialogAccCmp.AddView(LvDialogAccPerson,
    5%x,19%x,80%x,50%x)
        PnlDialogAccCmp.AddView(BtnAddPersnAccused,
    5%x,20%x,30%x,12%x)
        PnlDialogAccCmp.AddView(BtnCancelPersonAccused,
    25%x,20%x,30%x,12%x)    
    End Sub
    Sub Activity_Resume

    End Sub
    Sub Activity_Pause (UserClosed As Boolean)

    End Sub
    Sub BtnAddPersnAccused_Click
        
    Dim a As String
        
    Dim b As String
         a=EditDlgAcusedName.Text   
    'Here i didn't get the text 
         b=EditText1.Text     
    End Sub
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Why don't you use the visual designer to create the panel layout?

    It is impossible to say why you don't get the text without seeing the complete project (File - Export as zip).
     
  8. Sreenadh OG

    Sreenadh OG Member Licensed User

    This is my example code.
     

    Attached Files:

    Last edited: Jan 30, 2015
  9. klaus

    klaus Expert Licensed User

    The problem is that you load a layout and then you initialize new instances of all views and add them to PnlDialogAccCmp which is not added to the activity.
    You should remove everything in Activity_Create, only leave Activity.LoadLayout("Layout1") !
    If you need to adjust the view positions you should do it in DesignerScripts.
     
    Sreenadh OG likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice