怎么才能延时显示呢?

这是wxWidgets论坛的中文版本。在这里,您可以用您的母语汉语讨论上面任一子论坛所涉及的所有关于wxWidgets的话题。欢迎大家参与到对有价值的帖子的中英互译工作中来!
Post Reply
happybamboo
Knows some wx things
Knows some wx things
Posts: 27
Joined: Tue Sep 16, 2008 4:19 am

怎么才能延时显示呢?

Post by happybamboo » Fri Oct 16, 2009 9:22 am

我现在想实现一个延时显示的动作,用鼠标左键点击一个图形,按下鼠标左键持续一秒钟时间后,图形变化,否则图形不变,这个动作怎么才能实现呢?
有高人可以给我解答吗?

BlueDream
Earned a small fee
Earned a small fee
Posts: 13
Joined: Tue May 19, 2009 4:07 am

Re: 怎么才能延时显示呢?

Post by BlueDream » Fri Oct 16, 2009 10:08 am

happybamboo wrote:我现在想实现一个延时显示的动作,用鼠标左键点击一个图形,按下鼠标左键持续一秒钟时间后,图形变化,否则图形不变,这个动作怎么才能实现呢?
有高人可以给我解答吗?
有个笨办法,在鼠标左键事件使用wxTimer,在时间事件中使图形变化,并停止timer

happybamboo
Knows some wx things
Knows some wx things
Posts: 27
Joined: Tue Sep 16, 2008 4:19 am

Re: 怎么才能延时显示呢?

Post by happybamboo » Mon Nov 30, 2009 12:54 am

BlueDream wrote:
happybamboo wrote:我现在想实现一个延时显示的动作,用鼠标左键点击一个图形,按下鼠标左键持续一秒钟时间后,图形变化,否则图形不变,这个动作怎么才能实现呢?
有高人可以给我解答吗?
有个笨办法,在鼠标左键事件使用wxTimer,在时间事件中使图形变化,并停止timer
不是你想的那样啊,大哥,我要求的是一秒钟之后鼠标左键还在按下的状态图形才会变化,不是鼠标点击一秒之后就变化

Utensil
Moderator
Moderator
Posts: 423
Joined: Sun Feb 03, 2008 11:38 am
Location: China

Post by Utensil » Tue Dec 22, 2009 1:12 pm

mouse down事件时:启动1秒计时器
mouse up事件时: 清空计时器
timer到时时间时: 显示图形

这样就可以实现了。
因为如果用户放开过鼠标,计时器就会被清空。一直没放开,才回到时。
In fascination of creating worlds by words, and in pursuit of words behind the world.

On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/

Post Reply