tornadofx-controls icon indicating copy to clipboard operation
tornadofx-controls copied to clipboard

[Help|Guide] AutocompletionEvent.AutoCompleted

Open NiranjanShah opened this issue 7 years ago • 5 comments

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

NiranjanShah avatar Feb 04 '18 15:02 NiranjanShah

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

edvin avatar Feb 04 '18 16:02 edvin

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<String>("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 [email protected] 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.

NiranjanShah avatar Feb 04 '18 16:02 NiranjanShah

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

edvin avatar Feb 04 '18 16:02 edvin

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 [email protected] 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

NiranjanShah avatar Feb 04 '18 17:02 NiranjanShah

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.

edvin avatar Feb 04 '18 17:02 edvin