GTK 함수 중에 현재 focus의 위치를 알아낼수 있는 함수가 있나요??

liveeasily의 이미지

안녕하세요?

현재 GTK 를 이용해서 응용을 짜보고 있는 학생입니다.

GTK 함수 중에 현재 focus 의 위치를 알아낼 수 있는 함수가 있나요?

레퍼런스를 뒤져봤지만 찾기가 싶지 않네요ㅜㅜ

현재 focus를 가지고 있는 위젯을 반환하는 함수... 있을 듯 싶은데요...

제가 이런 함수를 찾고 있는 이유는 키보드, 마우스가 아닌 다른 입력장치에 의해 포커스를 이동시키고 위치한 포커스의 버튼같은 위젯을

"clicked" 된 것처럼 만들기 위해서 입니다.... ^^;;

keedi의 이미지

열려있는 toplevel 위젯을 순회하면서 gtk_widget_is_focus() 을 확인하면 되지 않나요?
아니면 위젯마다 focus시그널을 연결해서 포커스 올 때마다 전역변수 같은 곳에
현재 포커스 위젯의 포인터를 저장하는 방법도 있겠네요.

---------------------------
Smashing Watermelons~!!
Whatever Nevermind~!!

Kim Do-Hyoung Keedi

----
use perl;

Keedi Kim

liveeasily의 이미지

예, 제가 만들 콘트롤(리눅스 시작한지 얼마 안되서 위젯이란 말이 어색해요ㅜㅜ)을 리스트화 해놓고

gtk_widget_is_focus() 함수를 통해서 포커스를 가지고 있는 위젯의 인덱스를 반환하는 함수를 만들어 놓고 쓰고 있었습니다.

혹시 GTK API 중에 따로 함수가 있지 않을까 해서 여쭈어봤었습니다 ㅜㅜ

하지만 "열려있는 toplevel 위젯 순회하면서" 라는 부분에 대해서 잘 이해가 되지 않고 있습니다.

조금만 쉽게 설명해주실수 있을까요? ^^;;;;

GTK 는 책도 잘 없고.. 오직 영문 레퍼런스에 의지 하려니 많이 벅찹니다 ㅜㅜ

keedi의 이미지

gtk_window_list_toplevels() 사용하신거죠?
벌써 찾으셨나보네요. :-)

---------------------------
Smashing Watermelons~!!
Whatever Nevermind~!!

Kim Do-Hyoung Keedi

----
use perl;

Keedi Kim

liveeasily의 이미지

축복받으실꺼에요 ^^~

liveeasily의 이미지

keedi 님 말씀 하신대로 toplevel 위젯을 순회.... 하기 위한 방법을 찾다가

레퍼러슨 중 GtkWindow 부분에서 찾은 듯 싶습니다.

--------------------------------------------------------------------------------------------
gtk_window_get_focus ()

GtkWidget* gtk_window_get_focus (GtkWindow *window);

Retrieves the current focused widget within the window. Note that this is the widget that would have the focus if the toplevel window focused; if the toplevel window is not focused then GTK_WIDGET_HAS_FOCUS (widget) will not be TRUE for the widget.

window : a GtkWindow
Returns : the currently focused widget, or NULL if there is none.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.