Wiki improvements

Forum for discussion about the documentation project.
Tourist Trap
Posts: 2756
Joined: Jun 02, 2015 16:24

Re: Wiki improvements

Postby Tourist Trap » May 21, 2019 11:45

fxm wrote:I am still waiting for any article proposed by users:
- either provided already written (perhaps only a final formatting to be done for a better integration with the existing articles),
- or provided in the form of a list of references to posts/topics with enough material to be able, after synthesis, to constitute a complete article in itself.

Hi fxm,

Would an example of an UDT that shows how to do something like a button with mouseover, mouseclick, and mousedrag, be useful? It's something that I always use and that I didn't find in the doc. So maybe it could be worth sharing. Or not. Let me know.

By the way I want to say that your articles have improved a lot. They are still technical, but you provide all the logic and the examples in good order, so that's perfectly reachable for anyone that is curious of the topic described.
fxm
Posts: 8972
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Postby fxm » May 21, 2019 13:23

Tourist Trap wrote:Would an example of an UDT that shows how to do something like a button with mouseover, mouseclick, and mousedrag, be useful? It's something that I always use and that I didn't find in the doc. So maybe it could be worth sharing. Or not. Let me know.
Yes, it seems interesting as an article on FreeBasic, especially if the proposed code is multi-platform and fully written in FB.
Can you output something?
(we will see after if it is necessary to enrich it with some other method/example and explanations)

Tourist Trap wrote:By the way I want to say that your articles have improved a lot. They are still technical, but you provide all the logic and the examples in good order, so that's perfectly reachable for anyone that is curious of the topic described.
If you find that some of my previous articles could be much improved by reorganizing their content, do not hesitate to tell me (with your critics). I'll see what I can do.
Tourist Trap
Posts: 2756
Joined: Jun 02, 2015 16:24

Re: Wiki improvements

Postby Tourist Trap » May 21, 2019 13:50

fxm wrote:Yes, it seems interesting as an article on FreeBasic, especially if the proposed code is multi-platform and fully written in FB.
Can you output something?

My idea was something like that:
viewtopic.php?f=7&t=24907&p=222768&hilit=drag#p222768

Not the same as in this tip&trick, but something simpler that would be built step by step, starting with a simple button, then adding to it simple interactivity, and the drag&drop feature with dropzones at the end.

I always wanted to rewrite it for myself anyway so I could work at it and share it without any problem, as soon as I have time.
fxm
Posts: 8972
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Postby fxm » May 21, 2019 14:48

Yes, more simple and more logic when using properties versus directly using their data fields, suppressing the useless operators and even some macros...
Big work for all this!
Tourist Trap
Posts: 2756
Joined: Jun 02, 2015 16:24

Re: Wiki improvements

Postby Tourist Trap » May 21, 2019 16:38

fxm wrote:Yes, more simple and more logic when using properties versus directly using their data fields, suppressing the useless operators and even some macros...
Big work for all this!

If it takes long it doesn't matter since it's better to have something rather than nothing at the end :)
fxm
Posts: 8972
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Postby fxm » May 22, 2019 7:19

coderJeff, dkl,

I updated my old bug report:
Operator Let() (Assignment) incompatible with inheritance
because I've come to understand now how this operator behaves in the case of a Type that Extends a Base:
Bug report discussion wrote:When the Type Extends a Base, the first variable (in the list of variables) assigned by the operator Let() (Assignment) then corresponds to a Base instance (only the other variables are those to receive the values of the data fields of the Type).

Is this present behavior wanted or definitely accepted?
- If so, we should update the documentation page.
- If not, should we report (by a 'note') this current behavior in the documentation page?
coderJeff
Site Admin
Posts: 2881
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Wiki improvements

Postby coderJeff » May 24, 2019 1:38

marcov wrote:CHM contents are html files, string sin CHM internal files are UCS2/UTF16. I happen to be fixing the FPC chm doc tool and compiler this weekend, and it turns out the MS hhc compiler replaces things like ' from HTML topic titles when moving them into indexes, so maybe it does with 4 char escapes too.

I don't think we have any unicode usage in topic titles yet so probably haven't seen that problem in our wiki yet.

I did some testing, and the on line wiki supports UTF8 storage and rendering very well. And with our doc generator the UTF8 passes through to HTML also very well, using <meta charset="UTF-8"> in the HTML output, even in CHM reader.

So I was baffled, as I could not remember why we are using HTML escapes in first place. Took me a while to figure out: the first versions of the on line wiki did not support UTF8; only iso-8859-1 encoding (I think) was used initially. So as a work around to get specific characters to show in a browser, the HTML escapes were used.
coderJeff
Site Admin
Posts: 2881
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Wiki improvements

Postby coderJeff » May 24, 2019 2:13

fxm wrote:coderJeff, dkl,

I updated my old bug report:
Operator Let() (Assignment) incompatible with inheritance
because I've come to understand now how this operator behaves in the case of a Type that Extends a Base:
Bug report discussion wrote:When the Type Extends a Base, the first variable (in the list of variables) assigned by the operator Let() (Assignment) then corresponds to a Base instance (only the other variables are those to receive the values of the data fields of the Type).

Is this present behavior wanted or definitely accepted?
- If so, we should update the documentation page.
- If not, should we report (by a 'note') this current behavior in the documentation page?


I think updating the documentation that the present behaviour is expected is a good resolution for the bug report.
fxm
Posts: 8972
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Postby fxm » May 24, 2019 5:27

Done:
KeyPgOpLetlist → fxm [Added the inheritance case (description + example)]
fxm
Posts: 8972
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Postby fxm » May 26, 2019 5:48

fxm wrote:I proposed to write an article around this subject:
fxm wrote:Another potential new article #18 ?

About:
    How is array passed to FB procedure and what can procedure body do versus main body
I already wrote posts around this topic.
I could complete these and reword/synthesize all that in an article.

Would some people be interested in such an article?

But as only one person echoed (paul doe, favorably, but probably already knew the subject), I did not write it.

To have an article on this subject (only about what FB currently allows) does it interest someone else?
(before I delete my preliminary notes)
dodicat
Posts: 5771
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Wiki improvements

Postby dodicat » May 26, 2019 10:18

There has been a complaint recently about the ability to redim a fixed size array inside a sub or function (or any scoped block for that matter)

Code: Select all



dim as integer i(5)
for n as long=0 to 5
    i(n)=n^2
    print i(n);
next
print
print

scope
    redim i(10)
    for n as long=0 to 10
    i(n)=-n^2
    print i(n);
next
print
end scope



print
for n as long=0 to 5
    print i(n);
next
print
sleep
 


Personally I think this is OK.

A method for determining whether the array pointer was on stack(fixed size) or off stack (dynamic), (without using asm) could perhaps interest some forum members.

If you have produced an article about arrays in general then it would interest many I am sure.
MrSwiss
Posts: 3083
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Wiki improvements

Postby MrSwiss » May 26, 2019 12:02

dodicat wrote:There has been a complaint recently about the ability to redim a fixed size array inside a sub or function (or any scoped block for that matter)

Static arrays can't be resized, period. Some code might look like it's possible but,
we are dealing with a wrong assumption here, because:

Regarding your posted code:

the array inside the scope-block is totally independent (standalone), from
the one outside the scope-block (therefore, "ReDim" is misleading in the
context ... using "Dim" whould do, too.)

NOTE: on leaving the scope-block, everyting declared inside is destroyed!
(this is the reason, that there is no "duplicated ..." error, from compiler)
dodicat
Posts: 5771
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Wiki improvements

Postby dodicat » May 26, 2019 12:19

Yea, that was a stupid example of mine MrSwiss.
I should have used a sub for an example.

Code: Select all

sub dothis(a() as integer)
    redim preserve a(10)
    for n as long=0 to 10
   if n>5 then a(n)=-n^2
    print a(n);
next
end sub


dim as integer i(5)
for n as long=0 to 5
    i(n)=n^2
    print i(n);
next
print


dothis(i())

print

print
for n as long=lbound(i) to ubound(i)
    print i(n);
next
print
sleep
   
MrSwiss
Posts: 3083
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Wiki improvements

Postby MrSwiss » May 26, 2019 12:35

dodicat wrote:I should have used a sub for an example.

It's similar, to a scope-block, as soon as the sub is left, we're back
to square A1. (a(10) is temporary only! should IMO, be disallowed,
or at least throw a Warning/Error)
a()'s bounds checks are the originally defined ones! Even inside Sub.

Code: Select all

Sub dothis(a() as integer)
    redim preserve a(10)
    for n as long=0 to 10
        If n>5 then a(n)=-n^2
        Print a(n);
    Next
    Print : Print
    Print "a("; Str(LBound(a)); " To "; Str(UBound(a)); ")"
    print
end sub


dim as integer i(5)
for n as long=0 to 5
    i(n)=n^2
    print i(n);
next
print


dothis(i())
Print "i("; Str(LBound(i)); " To "; Str(UBound(i)); ")"

print

print
for n as long=lbound(i) to ubound(i)
    print i(n);
next
print
Sleep
I'm pretty confident, that this behaviour is very close, to a bug ...
More fun is: "commenting out" Redim Preserve a(10), doesn't change anything!
(except, special checking options, like -exx are used to compile)
Last edited by MrSwiss on May 26, 2019 13:34, edited 1 time in total.
fxm
Posts: 8972
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Postby fxm » May 26, 2019 13:33

MrSwiss wrote:More fun is: "commenting out" Redim Preserve a(10), doesn't change anything!

The difference is that in this case, when compiling with the -exx option, you always get an "error 6 (out of bounds array access)" execution error.

Return to “Documentation”

Who is online

Users browsing this forum: No registered users and 1 guest