I have a checkbox that is supposed to trigger whether or not a button is visible. Below is the code:
PUBLIC SUB chkGiveUp_Click() ' Check to see if the Give Up button's visible property is set to true, and if it is, hide the button. If it is hidden, show it again. IF btnClearAnswer.Visible THEN btnGiveUp.Visible = FALSE RETURN END IF IF btnGiveUp.Visible = FALSE THEN btnGiveUp.visible = TRUE RETURN END IF END
However, it is not exiting the sub properly and therefore one if contradicts the other. What is the proper way to do this? I am a beginner gambas programmer transferring over from VB6. I'm running gambas2 on Ubuntu 11.10, and the project type is a graphical application.
I think if you put the "return" after the "end if" it might work the way you want it to...
IF btnClearAnswer.Visible THEN btnGiveUp.Visible = FALSE Else btnGiveUp.Visible = FALSE THEN btnGiveUp.visible = TRUE END IF RETURN
You'll have to double check my command names though, since I don't know GAMBAS... but these languages are all enough alike that I can see the problem... by both statements just being 'IF'... they are both being ran... (check and make sure "RETURN" is the right command also... some languages use "RET") if it were my program and that didn't work I would just switch to a select case