PlanetSquires Forums

Support Forums => PlanetSquires Software => Topic started by: Petrus Vorster on February 13, 2023, 09:47:36 AM

Title: Shared Variable length strings
Post by: Petrus Vorster on February 13, 2023, 09:47:36 AM
Hi All

How do I create a shared variable length string in WINFBE?
I need to create a constantly changing list of about 40 items , but I will need to be able to access that list from different functions.

I also need to create a variable length array from that list and make the array accessible to the other functions and update the array as the list changes.

A few Pointers will be most helpful.

Regards,

Peter

Title: Re: Shared Variable length strings
Post by: Paul Squires on February 13, 2023, 10:22:41 AM
A shared (global) string can be created by using DIM SHARED at the top of your source file outside of any sub or function.

dim shared myString as string

You would do the same for an array:

redim shared myArray() as string




Title: Re: Shared Variable length strings
Post by: Petrus Vorster on February 13, 2023, 10:26:26 AM
I see what i did.

I was at the right place, but i tried to add the string content there as well.

That would be a problem.
Moved that bit to a function and now it works.


Regards

Peter
Title: Re: Shared Variable length strings
Post by: Paul Squires on February 13, 2023, 10:30:19 AM
No problem. I also edited my post because I think that dynamic shared arrays need to be created using "REDIM SHARED" rather than "DIM SHARED". I am not on my Windows computer right now but the FB online help seems to suggest that REDIM SHAREDis what you need to use.
Title: Re: Shared Variable length strings
Post by: Petrus Vorster on February 14, 2023, 07:29:26 AM
Thank you so much Paul.

You cannot imagine how chuffed I am over this little predictive text function that now works like a charm.

This forum and its members are just remarkable.

Regards,
Peter