Android Question [Solved] [B4X] PrefDialog Multiline EditText properties

fredo

Well-Known Member
Licensed User
Longtime User
Is it possible to hide or move the icons "del" and "check" in a multiline edit text?

2019-09-30_08-01-58.jpg


2019-09-30_08-07-12.jpg
2019-09-30_08-02-23.jpg
B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    
    Public PrefDialog As PreferencesDialog

    Private Base As B4XView
    Private xui As XUI
        
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
    Base = MainForm.RootPane
    
    CallSubDelayed(Me, "Button1_Click")
    
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub Button1_Click

    Dim DialogPanelWidth As Int  = 400dip
    Dim DialogPanelHeight As Int = 250dip

     PrefDialog.Initialize(Base, "Single Dialog created via 'PreferencesDialog'", DialogPanelWidth, DialogPanelHeight)
    PrefDialog.LoadFromJson(File.ReadString(File.DirAssets, "B4xPrefBuilderMultiline1.json"))

    Dim item As Map = CreateMap("c6noteedit": $"
"People often say that motivation doesn't last. Well, neither does bathing -- that's why we recommend it daily." -Zig Ziglar

"Someday is not a day of the week." -Denise Brennan-Nelson

"Hire character. Train skill." -Peter Schutz   
    "$)

    

    Wait For (PrefDialog.ShowDialog(item, "OK", "CANCEL")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Log("#-  x41, item = " & item)
    End If


End Sub

Testproject attached.
 

Attachments

  • TestDialog.zip
    3.9 KB · Views: 246

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can hide these buttons with this code:
B4X:
Dim sf As Object = p.ShowDialog(d, "OK", "CANCEL")
For i = 0 To p.PrefItems.Size - 1
   Dim pi As B4XPrefItem = p.PrefItems.Get(i)
   If pi.ItemType = p.TYPE_MULTILINETEXT Then
       Dim ft As B4XFloatTextField = p.CustomListView1.GetPanel(i).GetView(0).Tag
       ft.lblClear.Left = -100dip
       ft.lblV.Left = -100dip
   End If
Next
Wait For (sf) Complete (Result As Int)
 
Upvote 0

fredo

Well-Known Member
Licensed User
Longtime User
You can hide these buttons ...

Thanks for the smart approach.

The changes are apparently accepted by the labels (see logpoints x54 and x58) but in the display they remain in the old state (1).



2019-10-01_10-27-58.jpg


B4X:
#Region Project Attributes
    #MainFormWidth: 500
    #MainFormHeight: 400
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
  
    Public PrefDialog As PreferencesDialog

    Private Base As B4XView
    Private xui As XUI
      
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
    Base = MainForm.RootPane
  
    CallSubDelayed(Me, "Button1_Click")
  
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub Button1_Click As ResumableSub
    Log("#-Sub Button1_Click")

    Dim DialogPanelWidth As Int  = 400dip
    Dim DialogPanelHeight As Int = 250dip

    PrefDialog.Initialize(Base, "Single Dialog created via 'PreferencesDialog'", DialogPanelWidth, DialogPanelHeight)
    PrefDialog.LoadFromJson(File.ReadString(File.DirAssets, "B4xPrefBuilderMultiline1.json"))

    Dim datamap As Map = CreateMap("c6noteedit": $"
"People often say that motivation doesn't last. Well, neither does bathing -- that's why we recommend it daily." -Zig Ziglar

"Someday is not a day of the week." -Denise Brennan-Nelson

"Hire character. Train skill." -Peter Schutz 
    "$)


    Dim sf As Object = PrefDialog.ShowDialog(datamap, "OK", "CANCEL")
    For i = 0 To PrefDialog.PrefItems.Size - 1
        Dim pi As B4XPrefItem = PrefDialog.PrefItems.Get(i)
        Log($"#-    x52, pi.Key=${pi.Key}, pi.ItemType=${pi.ItemType},      (PrefDialog.TYPE_MULTILINETEXT=${PrefDialog.TYPE_MULTILINETEXT})  "$)
      
        If pi.ItemType = PrefDialog.TYPE_MULTILINETEXT Then
            Dim ft As B4XFloatTextField = PrefDialog.CustomListView1.GetPanel(i).GetView(0).Tag
      
          
            ' Hide the action labels (x) and (✓) by position them out of sight
            Log($"#-      x54, before: ft.lblClear.Left=${ft.lblClear.Left}, , ft.lblV.Left=${ft.lblV.Left}"$)
            ft.lblClear.Left = -100dip
            ft.lblV.Left = -100dip
            Log($"#-      x58, after:  ft.lblClear.Left=${ft.lblClear.Left}, , ft.lblV.Left=${ft.lblV.Left}"$)
          
        End If
      
    Next
      
  
  
    Wait For (sf) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Log("#-  x41, item = " & datamap)
    End If

    Return Null

End Sub


I think the affected item on the pref-CLV needs to be renewed. But how?


B4J Testproject 2 attached
 

Attachments

  • TestDialog2.zip
    4.2 KB · Views: 248
Last edited:
Upvote 0
Top