Clicking a Label

Hello. Newbie here.
I am not looking for a code example, otherwise I will never learn. I need some guidelines or logic to follow on how to approach and find the solution. A pseudo code will help.
I have a Label that when clicked using the MouseDown event makes a Canvas visible. Problem: I need to click again the same Label to make the Canvas invisible. I have tried checking the Boolean status of MouseDown but it did not work. Any input will be much appreciated.
Thank you in advance.
Luis

You can check the Visible property of the canvas. Or you can simply toggle that property.

Canvas1.Visible = not Canvas1.Visible

Thanks Tim and apologies for such a basic question, but may I ask how to get to those solutions? Years in front of the keyboard?
Luis

You become a competent software developer by doing/having a few things

  1. ask questions… especially on this forum, people are most often quite willing to help (as Tim did above)
  2. read the documentation, read this forum
  3. have an active imagination (without this you WILL fail)
  4. experiment! just because the docs don’t say it can be done, doesn’t mean it can’t… (see #3)
  5. attempt to solve situations yourself … this takes #2,#3 and #4 and combines them.
  6. if #5 doesn’t get it done the way you want, revert back to #1 :), but at least this will show the forum community that you tried, and are willing to learn

Everyone on this forum has their own strengths and their own weaknesses… but properly combined together, this makes for a great resource and community.

[quote=75037:@Luis Morana]Thanks Tim and apologies for such a basic question, but may I ask how to get to those solutions? Years in front of the keyboard?
Luis[/quote]
Dave’s advice is good. To add to his second point, become really familiar with the documentation. Get familiar with the layout of one page from the documentation - the rest of the docs will have a very similar structure. Check out http://documentation.xojo.com/index.php/Canvas and examine the properties section. You’ll see Visible property.

And don’t immediately dismiss sample code or examples. Take them and tear them apart to see how they work and then try to make some change. Dave’s items 3 & 4 are essential. Remember, even if the change you try doesn’t work you will have learned something.

Remember, there is no such thing as failure…just the successful elimination of an unworkable approach. Keep at it, ask questions as needed and have fun doing incredible things.

I like that :slight_smile:

Almost as good as

Thank you Gentlemen. All very good advises but I should say that Gavin S. nailed down the difficulty I have. Being able to interpret the documentation is my problem. Before posting a question I read the doc, Language Reference, Google, etc. but I find difficulty translating the explanation in the Language Reference into code…or better to say I have difficulties making the connection between the documentation and my code. I guess this will come with time and practice.

I did tried the link Gavin S. mentioned above but it did not work. I was hoping this doc will bring some clarification about reading the layout of the Language Reference that comes with XOJO, that it is very complete, but sometimes difficult to grasp for me.
Greetings.
Luis.

Apparently the documentation site was down for a while. It is now back on and the link works.

I found that the best way to understand code is to experiment with the examples in short projects I then save for later use.

Remember… The Language Reference is just that a REFERENCE… it is NOT a tutorial… there are other documents better suited for that… not to mention tons of example code that comes with Xojo, and video / webinars available from various sources…

The LangRef is meant to be used and understood AFTER you have an understanding of how things work, not to teach that to you.

Dave S…Brilliant! thank you, thank you…I was starting to think that I went completely insane. After seeing how many people are working with XOJO I was getting to the conclusion that I was not capable of connecting the dots anymore. Now it makes sense. Great recommendation for a Newbie like me.

Michel B…Yes…Great Idea. I do something similar…when I find a pc of code that works (and understand why) I save it in a txt file with lots of my own explanations on how it works and why. I found this very useful for later.
Thanks for the update regarding the like. It is OK now.

Thank you all.
Luis.

[quote=75037:@Luis Morana]Thanks Tim and apologies for such a basic question, but may I ask how to get to those solutions? Years in front of the keyboard?
Luis[/quote]
Exactly. Some things are obvious only after you’ve seen them a few times. The code I posted is one of those tricks that can come in handy.

Welcome to the forum. Don’t be afraid to ask questions.

Luis, also check out Paul Lefebvre excellent Webinars. There are lots that might help you get started. https://www.xojo.com/support/webinar.php#archives

Great link Gavin, I will watch them with YouTube since I do not have a Facebook account.

Tim,
As a matter of fact (and thank you for the code) I used your first suggestion instead…“You can check the Visible property of the canvas” to find out the way it really works. I took me a few coffees but I finally did it using the “If” statement. Now, it is in my brain because I understood it.

Cheers
Luis.

Luis, at this stage in your programming efforts you should spend some free time reading the Users Guide PDFs that come in the “Documentation” folder when you download Xojo. These manuals help to explain how things work within the language. Once you begin to get a feel for that you then use the Language Reference when you don’t remember the exact syntax for a method call, what property names exist for a control etc. The Users Guide is often overlooked as it is sort of hidden from view while the Language Reference is always just a click away. You will learn a lot at this stage using the Users Guide.

Harrie,
Thanks for the recommendation. User Guide will be.
Cheers.
Luis.