edvin / tornadofx-controls

CSS Stylable Controls for JavaFX
Apache License 2.0
107 stars 16 forks source link

[Help|Guide] AutocompletionEvent.AutoCompleted #10

Open NiranjanShah opened 6 years ago

NiranjanShah commented 6 years ago

AutoCompleted event is not fired

tfParent.addEventHandler(AutoCompletionEvent.AUTO_COMPLETED) { println("Coming here") }

        tfParent.addEventFilter(AutoCompletionEvent.AUTO_COMPLETED)
        {
            println("Coming here")
        }

I believe this is the right way to trap the event, if it is correct then the AutoCompleted event of textfield is not getting fired.

Kindly guide in case the way its done is wrong

edvin commented 6 years ago

What type is tfParent? Please supply a complete, runnable code example that showcases the issue.

NiranjanShah commented 6 years ago

tfParent is TextField

import javafx.collections.ObservableList import javafx.scene.control.TextField import org.controlsfx.control.textfield.AutoCompletionBinding import tornadofx.* import tornadofx.controlsfx.bindAutoCompletion

class AutoCompleteTestApp : App(AutoCompleteTest::class)

class AutoCompleteTest : View("AutoComplete comboBox extension test")

{ var listGroupName = listOf("Apple","Mango","Cherry","Strawberry") private lateinit var tfParent : TextField

override val root = form {
    fieldset {
        field("Parent Name") {
            textfield()
            {
                tfParent = this
                bindAutoCompletion(listGroupName).apply {

                    addEventHandler(AutoCompletionBinding.AutoCompletionEvent.AUTO_COMPLETED)
                    {
                        println("Coming here")
                    }

                    addEventFilter(AutoCompletionBinding.AutoCompletionEvent.AUTO_COMPLETED)
                    {
                        println("Coming here")
                    }

                }
                //setOnAction { println("On ACtion") }
            }
        }
    }
}

}

Regards Niranjan G Shah

On 04-Feb-2018, at 9:39 PM, Edvin Syse notifications@github.com wrote:

What type is tfParent? Please supply a complete, runnable code example that showcases the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/edvin/tornadofx-controls/issues/10#issuecomment-362918284, or mute the thread https://github.com/notifications/unsubscribe-auth/AI4lwg4tT3DP-Fuy05Xjakkq6dUIidErks5tRdYfgaJpZM4R4meS.

edvin commented 6 years ago

You are listening for an AutoCompletionBinding from ControlsFX. It has no effect on the bindAutoCompletion function in TornadoFX-Controls :)

NiranjanShah commented 6 years ago

Can you please guide to how to listen for the event of Controlsfx in tornandofx.

On Sun, 4 Feb 2018 at 10:19 PM, Edvin Syse notifications@github.com wrote:

You are listening for an AutoCompletionBinding from ControlsFX. It has no effect on the bindAutoCompletion function in TornadoFX-Controls :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/edvin/tornadofx-controls/issues/10#issuecomment-362921165, or mute the thread https://github.com/notifications/unsubscribe-auth/AI4lwl3Or-3dYHZm3SnyEe_z9bVRT90Mks5tRd-pgaJpZM4R4meS .

-- Regards Niranjan G Shah

edvin commented 6 years ago

That would be described in the ControlsFX project, there is no difference between TornadoFX and JavaFX in that respect. If you want to listen to this event, use the corresponding component from ControlsFX instead.