Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the issues related to the focus of the AWTK control

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge about "what are the problems related to AWTK control focus". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

Control focus related issues I. Enable focus stay (tab stop)

In addition to edit controls, other controls that require focus retention can be implemented by specifying that the control's focusable property is true.

In XML, you can specify:

In C code, you can specify:

widget_set_prop_bool(widget, WIDGET_PROP_FOCUSABLE, TRUE);

If you specify the fuceable property as true, make sure the focused state data is defined in the style of the control, otherwise the focused state cannot be displayed because there is no style data. For example:

Two, switch focus button before and after 1. By default, the tab key cycles through focus.# ifndef TK_KEY_MOVE_FOCUS_NEXT#define TK_KEY_MOVE_FOCUS_NEXT "tab"#endif /*TK_KEY_MOVE_FOCUS_NEXT*/2. Keys that can be specified to move focus forward and backward for the current window.

move_focus_prev_key Specifies the key to move focus forward.

move_focus_next_key Specifies the key to move focus backward.

In this example, the arrow key up moves to the previous focus control and the arrow key down moves to the next focus control.

III. Keys for switching focus up, down, left and right

On some special hardware devices, there is no touch screen, only up, down, left, right, OK and cancel six keys.

To quickly switch focus, AWTK supports horizontal focus with the left and right keys and vertical focus with the up and down keys. This can be set via the following properties of the window:

move_focus_up_key The key that moves focus up.

move_focus_down_key The key that moves focus down.

move_focus_left_key The key that moves focus to the left.

move_focus_right_key The key that moves focus to the right.

Examples:

In this example, the arrow key up moves to the upper focus control and the arrow key down moves to the lower focus control. Arrow left moves to the left of the focus control, arrow right moves to the right of the focus control.

The soft keyboard itself cannot get focus, in order to receive key messages, you need to specify the attribute grab_keys="true".

4. Set initial focus

You can specify that the focused property of a control is true to set the control to initial focus.

In XML, you can specify:

In C, you can specify:

widget_set_prop_bool(widget, WIDGET_PROP_FOCUSED, TRUE);"What are the problems related to AWTK control focus" is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report