Page 2 of 2
Posted: Sat Dec 09, 2006 12:50 am
by PB
> you forgot to protect the variable
Where, in my code, is string$ already declared as a global?

Posted: Sat Dec 09, 2006 2:13 pm
by Trond
PB wrote:> you forgot to protect the variable
Where, in my code, is string$ already declared as a global?

Do I have to remind you of my signature?

Posted: Sat Dec 09, 2006 5:15 pm
by AND51
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!

Posted: Sat Dec 09, 2006 5:58 pm
by Trond
AND51 wrote: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!

Neither did I....
Posted: Sat Dec 09, 2006 6:32 pm
by AND51
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!!!!

Posted: Sun Dec 10, 2006 1:36 am
by PB
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).
Posted: Sun Dec 10, 2006 6:12 am
by netmaestro
Come. Ve haff VAYS uff makink you talk.. Vere did you gotted dat code? VERE?
Posted: Sun Dec 10, 2006 6:54 am
by PB
I got the code here:

Posted: Sun Dec 10, 2006 12:17 pm
by AND51
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!
Posted: Sun Dec 10, 2006 2:56 pm
by Dr. Dri
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.
Code: Select all
Debug StringField("Pure Basic", 1, ' ')
Debug StringField("PureStringBasic", 2, @"String")
output:
Pure
Basic
That's how windows resource functions work, if you want the resource #12 you can send 12 or "12"
Dri
Posted: Sun Dec 10, 2006 3:09 pm
by DarkDragon
Dr. 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.
Code: Select all
Debug StringField("Pure Basic", 1, ' ')
Debug StringField("PureStringBasic", 2, @"String")
output:
Pure
Basic
That's how windows resource functions work, if you want the resource #12 you can send 12 or "12"
Dri
You can't detect the size

.
Posted: Sun Dec 10, 2006 4:52 pm
by Dr. Dri
you don't understand what i mean...
make a resource file with this code :
make a pb file with this code :
Code: 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
EndIf
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