TextInput focus issue

24 views
Skip to first unread message

kate

unread,
Jan 30, 2019, 9:20:13 AM1/30/19
to Kivy users support
Hello,

UI contains 3 Screens and one of them 2 TextInput I use for searching.
The problem is that when I click on the text input, I can see the cursor blink once and then immediately disappear.

I also used  unfocus_on_touch =False from https://github.com/kivy/kivy/issues/3863, but in this screen it doesn't work.

Can someone please help?

Here is my kv code:

<DisplayTableData>:
    FloatLayout:
    canvas.before:
            Color:
                rgba: 1, 1, 1, 1
            Rectangle:
                pos: self.pos
                size: self.size

        Button:
            size_hint: .1, .1
            pos_hint: {'center_x': .1, 'center_y': .95}
size_hint: .2, .1
            text: "Operatiuni"
            font_size: self.height * 0.3
            background_color: .2, .2, .46 , 1
            on_press: root.logOutScope()
Button:
            size_hint: .2, .1
            pos_hint: {'center_x': .3, 'center_y': .95}
            text: "Adauga"
            font_size: self.height * 0.3
background_color: .2, .2, .46 , 1
            on_press: root.adaugaProduse()
        Button:
            size_hint: .2, .1
            pos_hint: {'center_x': .5, 'center_y': .95}
            text: "Actualizare"
            font_size: self.height * 0.3
background_color: .2, .2, .46 , 1
            on_press: root.getProducts()

        TextInput:
    size_hint: .18, .05
            pos_hint: {'center_x': .7, 'center_y': .97}
    text:''
            multiline: False
            hint_text : "Cod produs"
            id: produsCautatInput
            unfocus_on_touch: False
            focus: True
        TextInput:
            size_hint:  .18, .05
            pos_hint: {'center_x': .7, 'center_y': .91}
            text:''
            multiline: False
            hint_text : "Denumire produs"
            id: denumireCautatInput
        unfocus_on_touch: False
        focus: True
Button:
            size_hint: .2, .1
            pos_hint: {'center_x': .9, 'center_y': .95}
            text: "Cautare"
            font_size: self.height * 0.3
background_color: .2, .2, .46 , 1
            on_press: root.cautaProdus()

        GridLayout:
            cols: 1
            pos_hint: {'center_x': .5, 'center_y': .4}
            size_hint: .99, .8
            
            GridLayout:
                size_hint: 1, None
                size_hint_y: None
                height: 30
                cols: 4
                
            Label:
            text: "COD"
                    bold: True
                    text_size: None, None
        halign: 'center'
        valign: 'top'
        color : 0.51,0.12,0.153,1
        markup: True
            Label:
            text: "DENUMIRE"
                    bold: True
                    text_size: None, None
        halign: 'center'
        valign: 'top'
        color : 0.51,0.12,0.153,1
        markup: True
            Label:
            text: "CANTITATE"
                    bold: True
                    text_size: None, None
        halign: 'center'
        valign: 'top'
        color : 0.51,0.12,0.153,1
        markup: True
            Label:
            text: "PRET"
                    bold: True
                    text_size: None, None
        halign: 'center'
        valign: 'top'
        color : 0.51,0.12,0.153,1
        markup: True

    ScrollView:
                size: self.size
                BoxLayout:
                    RecycleView:
                        canvas.before:
                            Color:
                                rgba: .146, .2, .257, 1
                            Rectangle:
                                pos: self.pos
                                size: self.size
                        viewclass: 'TableLabel'
                        data: [{'text': str(x)} for x in root.data_items]
                        SelectableRecycleGridLayout:
                            cols: 4
                            default_size: None, dp(26)
                            default_size_hint: 1, None
                            size_hint_y: None
                            height: self.minimum_height
                            orientation: 'vertical'
                            color : 0.51,0.12,0.153,1
                            markup: True
                            text_size: None, None

Reply all
Reply to author
Forward
0 new messages