[Gambas-user] Disabled controls still react to events

Philip A. Chapman pchapman at ...129...
Thu Oct 2 20:20:36 CEST 2003


Everyone,

After writing the email, I had an idea.  I put a WAIT statement in my
code before the btnProcess.Enabled = TRUE.  This worked as the click
event was then processed before the button was re-enabled.

In many languages, long running work would be done in a seperate thread
and the GUI notified when the work was done.  It does not appear that
there is any threading support in Gambas.  Am I right?

Also, I haven't had any bright ideas to fix the window will not close
issue yet.

Thanks,


On Thu, 2003-10-02 at 12:57, Philip A. Chapman wrote:
> Everyone,
> 
> I've been away from the list for a little while.  I finally got the time
> to download the latest version of Gambas (0.70b).  I have a problem that
> I need help with.  I do not know if it is a problem with my
> understanding of the qt library, or a bug.  When I try to disable a
> button while a long running process is running the button does indeed
> ignore the click event.  However, after the long running process has
> finished, any click events on the disabled button is processed.
> 
> To see what I mean, create a form with a button called btnProgress and a
> Progress bar named pbrMyProgress.  Copy the following code into the
> form's code module.  Run the program.  Click on the button.  While the
> button is disabled and the progress bar is running, click on the button
> a second time.  After the progress bar finishes the first round, it will
> restart as the second click event is processed.
> 
> Also, I am still having trouble with code windows not wanting to close. 
> When I click the window close button on the window manager's form
> decoration, the window flashes, but does not close.  I thought this was
> fixed a while back?  If you need machine specific info for this problem,
> let me know.
> 
> <code>
> PRIVATE CONST PROGRESS_MAX AS Integer = 10000
> 
> ' ----------------------------------------------------------------------
> ' - Counts from 1 to PROGRESS_MAX and lets the progress bar show an    -
> ' - indication of how far in the count the program has gotten.         -
> ' ----------------------------------------------------------------------
> PUBLIC SUB btnProgress_Click()
> 
>   DIM iCount AS Integer
>   
>   ' Disable the UI while we work
>   ME.Mouse = Mouse.Wait
>   btnProgress.Enabled = FALSE
>   WAIT  ' Allow the components to redraw as disabled
>   
>   ' Do our "Work"
>   FOR iCount = 1 TO PROGRESS_MAX
>     pbrMyProgress.Value = CFloat(iCount) / PROGRESS_MAX
>   NEXT ' iCount
>   
>   ' Re-enable the UI
>   btnProgress.Enabled = TRUE
>   ME.Mouse = Mouse.Arrow
> 
> END
> 
> </code>
-- 
Philip A. Chapman

Application Development:
Java, Visual Basic (MCP), PostgreSQL, MySQL, MSSQL
Linux, Windows 9x, Windows NT, Windows 2000, Windows XP
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20031002/6b162d3e/attachment.sig>


More information about the User mailing list