Forum > Other
Advice/Guidance Needed With Our Freepascal Wiki
Aruna:
Hi, I started dabbling with the wiki.I can use some help in understanding how to separate two sections.I am not a Wikimedia expert. I am a total newbie.
I was searching for information and example code for Canvas.Rectangle on the wiki and I felt there was a need to bring things up to date? So I decided to do something about it.
You can see what I have done here:
Canvas.Rectangle
The difficulty I am having is separating the two sections clearly. I am not sure if I am explaining this clearly. I would also very much appreciate your thoughts and comments on if this will be useful or if I am simply wasting my time :)
Maybe I should split things up into separate pages? What does everyone else think? I would like to 'clearly' separate the content from where it says 'Another Example'
wp:
You can use section headings to separate chapters. See https://www.mediawiki.org/wiki/Help:Formatting
BUT: I really don't like to see drawing commands in a button OnClick handler. It leads to lots of issues for the user (*), and we here in the forum will have to answer user questions why such bad code is in the wiki. Please rewrite the section so that the code is in the Form's (Paintbox's, Panel's) OnPaint event - that's where drawing code must be executed!
(*) Explanation: Run the wiki's ButtonClick code --> The application will crash in some operating systems here (I think: mac). In the other operating systems the drawing is displayed fine, but you will have the issue that when the user drags another form over it the drawing will not be regenerated at the places covered. Or: Minimize the application and then restore it --> the drawing will be gone. This is because the form does not know how to redraw the rectangles. Only code in the OnPaint handler can be executed correctly whenever the OS needs to redraw a window.
Aruna:
--- Quote from: wp on August 25, 2024, 04:52:25 pm ---You can use section headings to separate chapters. See https://www.mediawiki.org/wiki/Help:Formatting
--- End quote ---
Thank you @wp
--- Quote from: wp on August 25, 2024, 04:52:25 pm ---BUT: I really don't like to see drawing commands in a button OnClick handler. It leads to lots of issues for the user (*), and we here in the forum will have to answer user questions why such bad code is in the wiki. Please rewrite the section so that the code is in the Form's (Paintbox's, Panel's) OnPaint event - that's where drawing code must be executed!
--- End quote ---
I wanted to keep it simple. This is why I stuck with just the form. Adding a component is extra overhead but if that is the way to do things by all means so be it. So let me get this right, do not use click events, and do not draw directly on the form. Correct? I will change the code @wp no worries and thank you for explaining I did not know.
--- Quote from: wp on August 25, 2024, 04:52:25 pm ---(*) Explanation: Run the wiki's ButtonClick code --> The application will crash in some operating systems here (I think: mac). In the other operating systems the drawing is displayed fine, but you will have the issue that when the user drags another form over it the drawing will not be regenerated at the places covered. Or: Minimize the application and then restore it --> the drawing will be gone. This is because the form does not know how to redraw the rectangles. Only code in the OnPaint handler can be executed correctly whenever the OS needs to redraw a window.
--- End quote ---
Understood and much obliged.
Martin_fr:
You are aware that there is actual documentation for classes? Outside of the wiki...
https://lazarus-ccr.sourceforge.io/docs/lcl/graphics/tcanvas.rectangle.html
Sources for those docs are in the Lazarus distribution (also available as help files with F1). And corrections can be submitted as merge-request or patch against the git repository. Files can be edited using fpdoc. (several utilities available, including one build into the IDE)
You can still add content to the wiki, like usage examples and what it will look like.
Aruna:
--- Quote from: Martin_fr on August 25, 2024, 05:41:33 pm ---You are aware that there is actual documentation for classes? Outside of the wiki...
https://lazarus-ccr.sourceforge.io/docs/lcl/graphics/tcanvas.rectangle.html
--- End quote ---
Yes I am @Martin_fr thank you for the link. When I was searching for documentation sure it was all there but never everything I needed to know in one single place.
Which made my life hard. This is the simple reason I thought what if I start from the function/method signature then show how it is broken down so the user understands how to call it with the correct types of parameters then give them some code and a screenshot of how it will look. Simple, all you need in one place and fully documented.
I am going to use what @wp just taught me about when you minimize the form and then restore it you lose the drawing. So why not give the reader both ways? And mention why not to use one over the other? I dunno I am just following my heart. (If @wp starts frowning I will revise and redo the page)
Let me ask you a question ok, if I may. Forget that you are comfortable and highly experienced with fpc and Lazarus. Forget that by looking at someone's code you can instantly spot where he/she has gone wrong. (That comes with many years of grunt work and hacking code.) Remember when you first started with fpc and Lazarus? And if you were looking for documentation would you rather have to skip jump and hop all over the internet searching? Or would you prefer something short and simple in one place but accurate and with some code you can actually run and test and learn? ( on second thoughts you do not have to answer that )
--- Quote from: Martin_fr on August 25, 2024, 05:41:33 pm ---Sources for those docs are in the Lazarus distribution (also available as help files with F1). And corrections can be submitted as merge-request or patch against the git repository. Files can be edited using fpdoc. (several utilities available, including one build into the IDE)
You can still add content to the wiki, like usage examples and what it will look like.
--- End quote ---
I will as and when time permits me to do so :-)
Navigation
[0] Message Index
[#] Next page