Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Set focus on button with blue border and force tab rotation
#1
1)
Is it possible to focus on a button with the blue border instead of the dotted inline border.
In the example code below I have 3 methods, but they work partially.
In the code below, the goal is to focus on button "FOCUS 2" with the blue border on dialog init.
Maybe it's not possible due to OS enforcing interface interaction in a certain way.
Or maybe a workaround possible?
(The blue border is default blue-ish border you see when you properly focus on button within a dialog-button)

2)
I assume the ID's in the dialog deceleration (dd) dictates tab order from one object to another.
Is it possible to enforce a tab rotation limited between a set of ID's without having to register a hotkey.
(With that I mean without registering [TAB] as a hotkey and then create code that processes the tab rotation)
For example the goal in code below is that [TAB] only focusses on buttons: "FOCUS 1" , "FOCUS 2" and "FOCUS 3".

Function focus_button_and_tab_rotation
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 197 111 "Dialog"
;3 Button 0x54032000 0x0 55 17 98 14 "FOCUS 1"
;4 Button 0x54032000 0x0 56 39 97 14 "FOCUS 2"
;5 Button 0x54032000 0x0 55 60 98 14 "FOCUS 3"
;6 Button 0x54032000 0x0 54 87 48 14 "ignore 1"
;7 Button 0x54032000 0x0 109 87 48 14 "ignore 2"
;END DIALOG
;DIALOG EDITOR: "" 0x2040308 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,,SetFocus id(4 hDlg) ;; METHOD 1: works only when pressing directional buttons (or home, end,...)
,,
,,act id(4 hDlg) ;; METHOD 2:  works only when pressing directional buttons (or home, end,...)
,,
,,SetFocus (id(4 hDlg)) ;; METHOD 3:  Works partially, shows dotted inline border
,,'D
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#2
1. Set default button.
https://blogs.msdn.microsoft.com/oldnew ... 0/?p=38283

2. Remove WS_TABSTOP style from other controls.
Quote:I assume the ID's in the dialog deceleration (dd) dictates tab order from one object to another.
No, it is the order of lines, and styles WS_TABSTOP, WS_GROUP.
#3
THANK YOU!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)