Where, in my code, is string$ already declared as a global?
[Implemented] Unlimited Separator$ length @ StringField()
I'm sorry and you're right. 'string$' is already protected, but when I postet my post, I didn't think about this. Sorry again! 
PB 4.30
Code: Select all
onErrorGoto(?Fred)However, my solution is fasteer, cause I don't save the returning value from ReplaceString() into 'string$#, but I put it directly into StringField().
This makes the whole procedure a 'one-liner'. With one line of code, you can also make a MACRO of it to increase performance!!!! 
PB 4.30
Code: Select all
onErrorGoto(?Fred)Whatever code I post is standalone and works. There is no need to protect
the variable at all if no global variable of the same name exists in the code.
And quite frankly, I never protect my variables at all because I know which
variables my apps use and which are global and which are not, because I
am in 100% control of my coding and don't need compiler "protection".
(Side-note: I just noticed my example was almost exactly the same as
something netmaestro posted on 9 May 2006 -- it was NOT stolen code,
I assure you).
the variable at all if no global variable of the same name exists in the code.
And quite frankly, I never protect my variables at all because I know which
variables my apps use and which are global and which are not, because I
am in 100% control of my coding and don't need compiler "protection".
(Side-note: I just noticed my example was almost exactly the same as
something netmaestro posted on 9 May 2006 -- it was NOT stolen code,
I assure you).
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Please, don't let this forum thread turn into an off-topic thread! I really want this feature in the next version as many other people want this, too!
PB 4.30
Code: Select all
onErrorGoto(?Fred)maybe something like this :
StringField(String$, Index, Separator.l)
if you don't send a value within the character range (depending on ascii or unicode) then it will be interpreted as a string address.
That's how windows resource functions work, if you want the resource #12 you can send 12 or "12"
Dri
StringField(String$, Index, Separator.l)
if you don't send a value within the character range (depending on ascii or unicode) then it will be interpreted as a string address.
Code: Select all
Debug StringField("Pure Basic", 1, ' ')
Debug StringField("PureStringBasic", 2, @"String")
output:
Pure
BasicDri
-
DarkDragon
- Addict

- Posts: 2347
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
You can't detect the sizeDr. Dri wrote:maybe something like this :
StringField(String$, Index, Separator.l)
if you don't send a value within the character range (depending on ascii or unicode) then it will be interpreted as a string address.
That's how windows resource functions work, if you want the resource #12 you can send 12 or "12"Code: Select all
Debug StringField("Pure Basic", 1, ' ') Debug StringField("PureStringBasic", 2, @"String") output: Pure Basic
Dri
bye,
Daniel
Daniel
you don't understand what i mean...
make a resource file with this code :
make a pb file with this code :
if you run this code you'll get twice the same image!
LoadBitmap_ is called once with an INTEGER and then with a STRING
as string are addresses, they are sent like integers
so if the resource number is too high then it will be interpreted as a string address
so if it works for resources it should be possible to do this for StringField
Dri
make a resource file with this code :
Code: Select all
12 bitmap your_image.bmpCode: Select all
If OpenWindow(0, 0, 0, 245, 105, "ImageGadget")
CreateGadgetList(WindowID(0))
ImageGadget(0, 10, 10, 100, 83, LoadBitmap_(GetModuleHandle_(#Null), 12))
ImageGadget(1, 130, 10, 100, 83, LoadBitmap_(GetModuleHandle_(#Null), "#12"))
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIfLoadBitmap_ is called once with an INTEGER and then with a STRING
as string are addresses, they are sent like integers
so if the resource number is too high then it will be interpreted as a string address
so if it works for resources it should be possible to do this for StringField
Dri



