Here is the code below where I have two native buttons and two dotNet controls.
When you open this dialog up pressing tab should cycle through each button but it doesn't as they're two different types.
Is there a way around this? To even get the dotNet controls working would be a start.
try destroydialog dialog catch()
rollout dialog "Tab Index" width:200 height:100
(
checkbutton show_bt "Button 1" width:100 height:20 align:#center
checkbutton btn_shift "Button 2" width:100 height:20 align:#center
dotnetcontrol btn1 "Button" text:"Button 3" width:100 height:20 align:#center
dotnetcontrol btn2 "Button" text:"Button 4" width:100 height:20 align:#center
on dialog open do
(
btn1.FlatStyle = btn1.FlatStyle.System
btn2.FlatStyle = btn2.FlatStyle.System
-- How can I set up tab index when using max buttons and dotNet buttons?
-- I want to cycle through them all inc. the native buttons when pressing
-- the tab key.
btn1.TabIndex = 0
btn2.TabIndex = 1
setFocus btn2
)
)
createdialog dialog
TabIndex not working on a dotNet form either.
(
fn pressingSituation_fn a b =
(
format "TabIndex value: %\n" a.TabIndex
)
-- Create a DotNet Button
mButton1 = dotNetObject "System.Windows.Forms.Button"
mButton1.text = "BIG DotNet Button 1"
mButton1.size = dotNetObject "System.Drawing.Size" 100 100
mButton1.location = dotNetObject "System.Drawing.Point" 0 0
-- Create a DotNet Button
mButton2 = dotNetObject "System.Windows.Forms.Button"
mButton2.text = "BIG DotNet Button 2"
mButton2.size = dotNetObject "System.Drawing.Size" 100 100
mButton2.location = dotNetObject "System.Drawing.Point" 100 100
-- TabIndex
mButton1.TabIndex = 0
mButton2.TabIndex = 1
-- Create a DotNet Form
hForm = dotNetObject "System.Windows.Forms.Form"
hForm.size = dotNetObject "System.Drawing.Size" 215 238
hForm.controls.add mButton1 -- Add the Button to the Form
hForm.controls.add mButton2 -- Add the Button to the Form
hForm.topmost = true
-- Add an Event Handler for the click event:
dotNet.addEventHandler mButton1 "click" pressingSituation_fn
dotNet.addEventHandler mButton2 "click" pressingSituation_fn
hForm.show() -- Show the Form with the Button
)
By 3dwannab · 2021-09-23