[英]Gtk Notebook “change-current-page” doesn't work
i am using gtk notebook. 我正在使用gtk笔记本。 I need to if user change current page, some button should be active.
如果用户更改当前页面,我需要一些按钮应该是活动的。 But current-page-change doesn't work, so nothing happens.
但是当前页面更改不起作用,所以没有任何反应。 I tried "switch-page" signal but it gives me previous page number when i asked "notebook.page".
我尝试了“switch-page”信号,但当我问“notebook.page”时,它给了我之前的页码。 But i need to if user change current page, i should know which page is selected.
但我需要如果用户更改当前页面,我应该知道选择了哪个页面。
The switch-page
signal sends the new page number as argument to the handler, so you can get it without asking the notebook. switch-page
信号将新页码作为参数发送给处理程序,因此您可以在不询问笔记本的情况下获取它。
The reason the notebook doesn't answer correctly is that when switch-page
is handled, the switch did not yet complete. 笔记本电脑无法正确应答的原因是,当处理
switch-page
时,交换机尚未完成。 (This allows your handler to cancel the switch or switch to a different page.) To connect to the signal after the switch has been performed, call connect_after
, in which case you'll get the new page number from the notebook. (这允许您的处理程序取消交换机或切换到其他页面。)要在执行切换后连接到信号,请调用
connect_after
,在这种情况下,您将从笔记本中获取新的页码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.