[Gambas-user] Programming beginner: first program won't run?

Doriano Blengino doriano.blengino at ...1909...
Mon Apr 20 10:06:53 CEST 2009


phohammer ha scritto:
>
>>> Okay, I realize I should RTFM, but I intended to fly at this with gambas'
>>> GUI
>>> and learn some programming, not Linux 
>>> terminal commands. I'm going to bow out for now. Thank you for your help,
>>> Ron_1st, jbskaggs, Charlie Reinl and 
>>> Doriano Blengino. I guess I'm not/don't have the time to be an "Advanced
>>> Bash-Scripter".
>>>
>>>       
> I'm not sure what you're talking about with Windows and VB. I don't use
> either one of them. I know Gambas uses a
>  lot of the BASIC language from VB, but other than that I'm not sure I
> follow...
>   
I like this! You have clear what you want, and what you want not.  :->>

Anyway, I opened your tarball (strangely, I had to use a windows(tm) 
program, the linux tar did'nt work).
The project was'nt running properly; at first it gave the error "Cannot 
load class FStart".
Did you notice that?

Then, in sub Main():

    STATIC PUBLIC SUB Main()
      DIM myForm AS Form
      myForm = NEW FStart
      myForm.Show
    END

I commented out the last two lines:

    STATIC PUBLIC SUB Main()
      DIM myForm AS Form
      'myForm = NEW FStart
      'myForm.Show
    END

At this point, the program started, but immediately terminated. By 
executing step by step, I noticed that after executing Main(), which 
does nothing because of the commented out lines, the program terminated 
- ie, it never entered the idle loop (the one where the program waits 
for user interation). Probably a subroutine named Main indicates that 
the program is embodied inside, and when Main() terminates the program 
terminates too.

Then, I commented out the whole subroutine:

    'STATIC PUBLIC SUB Main()
    '  DIM myForm AS Form
    '  myForm = NEW FStart
    '  myForm.Show
    'END

... and the program ran.

Hope this helps you to understand; I leave to you to discover why the 
subroutine Main() prevented the program from working (RTFM... :-) either 
it is a documented thing, or an undocumented one, or a bug).

Last thing, if you ask for help, pay attention to all the things that 
happen. I say so because my customers too many times say "it does'nt 
work", and it is true, but they do not bother to read messages and other 
things. You, as a programmer, should have noticed that error message 
about class FStart, and perhaps should have described differently the 
behaviour of the program: "it does nothing" it is not the optimal 
description.

Have fun with gambas (and linux...)!

Cheers,
Doriano





More information about the User mailing list