Re: [Gambas-user] Arrays of Structs

2016-11-29 Thread Gianluigi
Out of curiosity you may have a look here [0], and more precisely to
MyStruct-DB.

Regards
Gianluigi
[0]
http://gambas.8142.n7.nabble.com/Random-access-files-with-fixed-length-string-td50880.html

2016-11-29 5:38 GMT+01:00 Cam Era :

> On Tue, Nov 29, 2016 at 3:11 PM, Benoît Minisini <
> gam...@users.sourceforge.net> wrote:
>
> > ...
> > --> This creates an inner array of 50 MapObject NULL references.
> >
> > Try that: MapObjects[50] As Struct MapObject
> >
> > By the way, I strongly suggest not to use Struct, but normal objects.
> > Struct were mainly made to interface with C libraries.
> >
> > Regards,
> >
>
> Benoît,
>
> I'll do exactly that from now on.
>
> Thanks again.
>
>
> -- Cam
> 
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Setting focus to form.

2016-11-29 Thread Gianluigi
frmGenerating.ShowModal or ShowDialog?

Regards
Gianluigi

2016-11-29 1:50 GMT+01:00 Cam Era :

> Greetings all.
>
> I suspect that this is a question with an easy answer, but I've had no luck
> in finding it.
>
> In short, I have a project with two forms. One is the main form, the other
> a splash screen.
> While the first form loads, I display the splash screen with:
>
> frmGenerating.show
>
> and when the application has completed its loading stage, I close the
> splash screen with:
>
> frmGenerating.close
>
> At that point, I'd like the focus to come back to my main form, but I have
> found no way for this to occur. Things like FMain.SetFocus and
> FMain.Activate don't achieve this.
>
> Am using stock standard Ubuntu 16.04.
>
> Any suggestions?
>
> TIA
>
> -- Cam
> 
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Setting focus to form.

2016-11-29 Thread Rolf-Werner Eilert
In one of my projects, there are two forms the user switches forth and 
back with "F9". I use ".Main" to show the other form, so

FMain.Main

would it be in your case. But the calling form must still exist for this 
to run, so the splash screen would have to disappear later.

Try and tell if it does what you mean... Maybe Gianluigi's way is better...

Regards
Rolf

Am 29.11.2016 11:38, schrieb Gianluigi:
> frmGenerating.ShowModal or ShowDialog?
>
> Regards
> Gianluigi
>
> 2016-11-29 1:50 GMT+01:00 Cam Era :
>
>> Greetings all.
>>
>> I suspect that this is a question with an easy answer, but I've had no luck
>> in finding it.
>>
>> In short, I have a project with two forms. One is the main form, the other
>> a splash screen.
>> While the first form loads, I display the splash screen with:
>>
>>  frmGenerating.show
>>
>> and when the application has completed its loading stage, I close the
>> splash screen with:
>>
>>  frmGenerating.close
>>
>> At that point, I'd like the focus to come back to my main form, but I have
>> found no way for this to occur. Things like FMain.SetFocus and
>> FMain.Activate don't achieve this.
>>
>> Am using stock standard Ubuntu 16.04.
>>
>> Any suggestions?
>>
>> TIA
>>
>> -- Cam
>> 
>> --
>> ___
>> Gambas-user mailing list
>> Gambas-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>


--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Setting focus to form.

2016-11-29 Thread Gianluigi
Hello Rolf,

*FMain.Main* is very good!

If what that Cam Era need is a splash, he might also get with this:

FMain:

Public Sub Form_Open()

  Dim i As Integer

  Form1.Show
  ' Here I make something that I
  ' can communicate through Form1
  For i = 1 To 10
Form1.Comunicate("foo " & CStr(i))
Wait 1
  Next
  Form1.Comunicate("foo " & CStr(i))
  Me.SetFocus
  Form1.Hide

End
Public Sub Form_Close()

  Form1.Close

End


Form1(splash):

Public Sub Comunicate(value As String)

  Label1.Text = "Form 1 " & value

End

Regards
Gianluigi

2016-11-29 12:15 GMT+01:00 Rolf-Werner Eilert :

> In one of my projects, there are two forms the user switches forth and
> back with "F9". I use ".Main" to show the other form, so
>
> FMain.Main
>
> would it be in your case. But the calling form must still exist for this
> to run, so the splash screen would have to disappear later.
>
> Try and tell if it does what you mean... Maybe Gianluigi's way is better...
>
> Regards
> Rolf
>
> Am 29.11.2016 11:38, schrieb Gianluigi:
> > frmGenerating.ShowModal or ShowDialog?
> >
> > Regards
> > Gianluigi
> >
> > 2016-11-29 1:50 GMT+01:00 Cam Era :
> >
> >> Greetings all.
> >>
> >> I suspect that this is a question with an easy answer, but I've had no
> luck
> >> in finding it.
> >>
> >> In short, I have a project with two forms. One is the main form, the
> other
> >> a splash screen.
> >> While the first form loads, I display the splash screen with:
> >>
> >>  frmGenerating.show
> >>
> >> and when the application has completed its loading stage, I close the
> >> splash screen with:
> >>
> >>  frmGenerating.close
> >>
> >> At that point, I'd like the focus to come back to my main form, but I
> have
> >> found no way for this to occur. Things like FMain.SetFocus and
> >> FMain.Activate don't achieve this.
> >>
> >> Am using stock standard Ubuntu 16.04.
> >>
> >> Any suggestions?
> >>
> >> TIA
> >>
> >> -- Cam
> >> 
> >> --
> >> ___
> >> Gambas-user mailing list
> >> Gambas-user@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>
> > 
> --
> > ___
> > Gambas-user mailing list
> > Gambas-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
>
> 
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Setting focus to form.

2016-11-29 Thread Charlie
Here is my contribution to this solution. This code shows a 'Splash' screen
while doing a little work then closes the 'Splash' and returns the focus to
FMain.
Hope it helps.
FMainFocus.tar   



--
View this message in context: 
http://gambas.8142.n7.nabble.com/Setting-focus-to-form-tp57909p57920.html
Sent from the gambas-user mailing list archive at Nabble.com.
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Arrays of Structs

2016-11-29 Thread Christof Thalhofer
Am 29.11.2016 um 05:38 schrieb Cam Era:

>> By the way, I strongly suggest not to use Struct, but normal objects.
>> Struct were mainly made to interface with C libraries.
> 
> I'll do exactly that from now on.

For object-oriented programming in Gambas a struct can be replaced with
a class. When I started Gambas programming I also made some structs for
the purpose of bringing a couple of variables together to define an
object. But in Gambas the right tool for that is a class.

The class defines an object, you can create an array of a couple of such
objects and you can sort that array.


Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur



signature.asc
Description: OpenPGP digital signature
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Arrays of Structs

2016-11-29 Thread Gianluigi
Hello Christof,

I do not use structures and would not recommend using them.
I have only mentioned a file that could satisfy the curiosity of Cam.
In this regard I point to my example DynamicMatrixExample of Software farm.

Regards
Gianluigi

2016-11-29 19:17 GMT+01:00 Christof Thalhofer :

> Am 29.11.2016 um 05:38 schrieb Cam Era:
>
> >> By the way, I strongly suggest not to use Struct, but normal objects.
> >> Struct were mainly made to interface with C libraries.
> >
> > I'll do exactly that from now on.
>
> For object-oriented programming in Gambas a struct can be replaced with
> a class. When I started Gambas programming I also made some structs for
> the purpose of bringing a couple of variables together to define an
> object. But in Gambas the right tool for that is a class.
>
> The class defines an object, you can create an array of a couple of such
> objects and you can sort that array.
>
>
> Alles Gute
>
> Christof Thalhofer
>
> --
> Dies ist keine Signatur
>
>
> 
> --
>
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Arrays of Structs

2016-11-29 Thread Tony Morehen
I may just be responding to a typo but your struct is named MapObjec 
while the code using it refers to MapObject.


On 28/11/16 10:40 PM, Cam Era wrote:
> I expect I'm trying to do something that's not possible with Gambas, but
> I'll ask this anyway.
>
> I'm trying to create an n x n array of a STRUCT which itself contains an
> array of type STRUCT.
>
> I have this declaration:
>
>  Public Struct MapObjec
>xPos As Integer
>yPos As Integer
>ObjectType As Integer
>isVisible As Boolean
>ObjectPicture As Picture
>  End Struct
>
>  Public Struct MapRoom
>MapObjects[50] As MapObject
>  End Struct
>
>  Static Private WorldMap[100, 100] As MapObject
>
>
> and this code:
>
>  WorldMap[5, 10].MapObjects.yPos = 100
>
>
> which generates a "NULL object" error.
>
> Any pointers as to whether this is possible and if so, how?
>
>
> Cheers
>
> -- Cam
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Arrays of Structs

2016-11-29 Thread nando_f
I use structs to write binary to a file in struct order.
Nice and easy.
Not so easy with a class.

Your example is possible.  I have done similar.

The STRUCT only defines the structure...it doesn't create the memory allocation.
Static Private WorldMap[100, 100] As MapObject  just defines arrays to point to 
objects.
You need to run code to actually create new objects at each array element.
hint:
Loop  x
 Loop  y
   [x][y] = new MapObject  'the new actually creates a memory allocation for it.

-Fernando

--
Open WebMail Project (http://openwebmail.org)


-- Original Message ---
From: Tony Morehen 
To: gambas-user@lists.sourceforge.net
Sent: Tue, 29 Nov 2016 15:29:03 -0500
Subject: Re: [Gambas-user] Arrays of Structs

> I may just be responding to a typo but your struct is named MapObjec 
> while the code using it refers to MapObject.
> 
> On 28/11/16 10:40 PM, Cam Era wrote:
> > I expect I'm trying to do something that's not possible with Gambas, but
> > I'll ask this anyway.
> >
> > I'm trying to create an n x n array of a STRUCT which itself contains an
> > array of type STRUCT.
> >
> > I have this declaration:
> >
> >  Public Struct MapObjec
> >xPos As Integer
> >yPos As Integer
> >ObjectType As Integer
> >isVisible As Boolean
> >ObjectPicture As Picture
> >  End Struct
> >
> >  Public Struct MapRoom
> >MapObjects[50] As MapObject
> >  End Struct
> >
> >  Static Private WorldMap[100, 100] As MapObject
> >
> >
> > and this code:
> >
> >  WorldMap[5, 10].MapObjects.yPos = 100
> >
> >
> > which generates a "NULL object" error.
> >
> > Any pointers as to whether this is possible and if so, how?
> >
> >
> > Cheers
> >
> > -- Cam
> > --
> > ___
> > Gambas-user mailing list
> > Gambas-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
--- End of Original Message ---


--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user