Page 1 of 1
Posted: Tue Apr 30, 2002 9:56 am
by BackupUser
Restored from previous forum. Originally posted by naw.
Hi All, Is there anything like Unix ksh "exec" command in PB?
I'm not a compiler boffin, but I suspect that this may be impossible
because PB is a compiler not an interpreter...
Anyway I want to be able to do the following:
X$="MessageRequester('Y','Z',0)"
exec X$
Ta - N
Posted: Tue Apr 30, 2002 9:36 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> Anyway I want to be able to do the following:
> X$="MessageRequester('Y','Z',0)" : exec X$
You're right: you can't. There may be other ways to achieve what you want,
if you can be a little more specific?
PB - Registered PureBasic Coder
Posted: Wed May 01, 2002 10:26 am
by BackupUser
Restored from previous forum. Originally posted by naw.
I'd like to import *Variables* from an external Text File that builds a configurable GUI a bit like this...
TextFile.txt:
TextGadget,1,2,3,4,"Hello World"
PseudoCode:
while read "./TextFile.txt" into gadget$ x y w h text$
gadget$(x,y,w,h,text$)
done
- I've got no chance, have I

Posted: Wed May 01, 2002 12:05 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
PseudoCode:
while read "./TextFile.txt" into gadget$ x y w h text$
gadget$(x,y,w,h,text$)
done
Well, you could always build up a look up table for the names of the gadgets:
Code: Select all
name$(0)="TextGadget"
name$(1)="ButtonGadget"
etc
gid=0
while Read "./Textfile.txt" into gadget$ x y w h text$
i=0 : found=0
while i<#MAXGADGETS And found=0
if gadget$=name$(i)
found=1
Else
i=i+1 ; oops forgot that :)
endif
wend
If found=1
Select i
Case 0
TextGadget(gid,x,y,w,h,text$)
Case 1
Buttongadget(gid,x,y,w,h,text$)
; etc
EndSelect
gid=gid+1
EndIf
Wend
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
Edited by - tinman on 01 May 2002 13:15:04
Posted: Wed May 01, 2002 1:23 pm
by BackupUser
Restored from previous forum. Originally posted by naw.
Yeah! Thats the way I've done it and it works, but only for things that I have in my lookup table... Thanks, though for taking a look (I posted my INI2GUI onto the PB Resource site - it was related to that...)
Cheers - N
Posted: Wed May 01, 2002 2:45 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
Yeah! Thats the way I've done it and it works, but only for things that I have in my lookup table... Thanks, though for taking a look (I posted my INI2GUI onto the PB Resource site - it was related to that...)
What's the problem with it only working for things in your lookup table? If new gadgets were added to PB you would have to recompile your source to get access to those anyway, so you could update your lookup table at the same time.
Or is there some other reason you don't want a lookup table?
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
Posted: Thu May 02, 2002 8:49 am
by BackupUser
Restored from previous forum. Originally posted by naw.
Or is there some other reason you don't want a lookup table?
Err! well yes, dont flame me for giving a *bad* reason, I am at least being honest here... I'm essentially very lazy and this:
exec cmd$(x,y,z,w,h,text$)
is shorter than this
select cmd$
case "TextGadget" : TextGadget(x,y,w,h,text$)
case "InputGadget" : InputGadget(x,y,w,h,text$)
case "InspectorGadget" : InspectorGadget(x,y,w,h,text$)
case "WidgetGadget" : WidgetGadget(x,y,w,h,text$)
.
.
.
.
endselect

Posted: Thu May 02, 2002 11:13 am
by BackupUser
Restored from previous forum. Originally posted by tinman.
honest here... I'm essentially very lazy and this:
exec cmd$(x,y,z,w,h,text$)
is shorter than this
That's an excellent reason
--
It's not minimalist - I'm increasing efficiency by reducing input effort.