I made a method that “shakes” bevel buttons when the user clicks on them.
This is for giving a visual clue that he shoudnt have selected that answer.
Basically the button moves a few pixels out of his original position and goes back with a quick interval using wend and ticks “trick” tha most of you know.
The problem is that the bevel button shrinks during the shaking and the borders disappear
Is there any way to redraw the control to prevent this ?
Method Shakebev(i as integer)
My intentio is to shake the bevel button in order to give a visual clue for the user, the problem is that the control is not redrawn
in the for-nect cycle, instead it gets smaller and disappears.
Is there any workaround for this ? Thanks
'win is the main window
'bev is a bevel button control
'parameter i is the index of bevel button control set
dim x,y,k as integer
dim sleep as integer
x=win.bev(i).left'memorize the initial positions of bevel
y=win.bev(i).top
for k=0 to 10
win.bev(i).left=x+randomizer.InRange(-20,20)' randomizer is a global variable of random type
win.bev(i).top=y+randomizer.InRange(-20,20)
sleep=ticks+5
While ticks < sleep 'pause
Wend
win.bev(i).left=x 'restore initial positions
win.bev(i).top=y
next
I added bev(i).REFRESH into my method and now it looks a lot better, but still not perfect bc the borders disappear but at least is much better than without “refresh”
The problem is the while/wend. It prevents normal drawing. Put your “shake” code in a timer. But don’t loop. Do one move each time the timer fires. That will allow the screen to redraw normally.