ScriptSpot

Forum topic · General Scripting

Button UI Control - confirm with enter Key

By ribis · 2018-05-17

Description

Hi, how can I send a event by pressing the [Enter] key on the keyboard, instead of using:

on pressed do
on rightclick do

thx

Comments (6)

1. Use a macroscript.2. You

citizenWOLF · 2018-05-26

1. Use macroscript.
2. You can use ahk script to send your event.

ribis · 2018-05-26

to a button.

.

jahman · 2018-05-26

use dotNetControl


try (destroydialog X ) catch ()
rollout X "" (

	dotNetControl btn "button" text:"SomeButton" height:20
	
	on X open do setFocus btn
		
	on btn KeyUp ev do (
		
		if ev.KeyCode == ev.KeyCode.Enter do format "Pressed Enter\n" 
		
	)

)
createDialog X

.

miauu · 2018-05-26

But the rollout must be "on focus".

.

miauu · 2018-05-25

Event to what? To a control in a rollout? To which control - button, checkbox, spinner,...?

liltaso2 · 2018-05-30

I think he means somehow making the enter key be able to be used to press ok (like when you are duplicating objects and the popup appear), perhaps accomplished by a macroscript to apply to that particular shortcut/key... or if Enter cant be used as shortcut, an alternative key