Page 1 of 1

update screwed everything up

Posted: Friday 10th January 2020 1:26am
by sadams54
I did the updates and now gambas is really screwed...

1.. global variables are handled differently and had to recompile everything to make it work again.
2.. after months of work making reports and other things print nicely, the update has randomly changed the print size of everything so font sizes are almost ignored.

Do I have to spend months rewriting software again to fix the problem? is there a easy fix?

Using fedora 30

Re: update screwed everything up

Posted: Monday 13th January 2020 5:34pm
by gbWilly
Hi,

1. You mention Global variables!!! Gambas doesn't have Global variables, so what exactly do you mean?
2. Did your default font type for your OS maybe change? As far as I am aware gb.Report2 has a certain order of checking what font type to use. An other font type might make fonts bigger or smaller.

Re: update screwed everything up

Posted: Thursday 16th January 2020 12:42am
by sadams54
there are global variables...

in the module section before and outside of any sub or function..
private A[300] as string this used to do it.
Public A As New String[300] is how it must be now... so yes there are global variables..

As for the printing I never mentioned anything about a report. I said printing and it is done directly using the paint object. The problem was similar to what you mentioned though. The paint.fontscale had to be set because it was made dynamic and in my printing I need static as paper sizes and fonts never change. benoit helped with that but still have problems with multiple page documents. after the first call of paint.end I get "no current object" error when creating the 2nd page. Still nothing about that anywhere and I can't do multiple page documents yet.

Re: update screwed everything up

Posted: Thursday 16th January 2020 1:21pm
by gbWilly
Hi,

Gambas has Private and Public variables.
- Private can be used within the Class
- Public can be used in and outside a Class

Global variables is a term that comes from Visual Basic.
And seeing many of us used to program in Visual Basic it is still often used by former Visual Basic developers when talking about Gambas.
I can't even remember how it used to work in Visual Basic but I do remember from my beginning days in Gambas that it is slightly different opposed to Visual Basic.
Not that it is that important, it's just terminology, as long as we all can understand what we mean it should be fine ;)
private A[300] as string this used to do it.
Public A As New String[300] is how it must be now
The first one you used is an embedded array.
This is what the wiki has to say about them (http://gambaswiki.org/wiki/cat/arraydecl):
Embedded arrays were created to ease the interface between Gambas and external functions located in shared libraries.
Consequently, I strongly suggest to use them only if you cannot use normal arrays.
Or if your code run faster with embedded arrays than with normal arrays, as it's possible in some cases.
The latter method is the preferred manner of doing things in Gambas (see above quote).
The fact that things don't work anymore as used to seems to be a bug.