Rename String to Input

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
nblackburn
User
User
Posts: 67
Joined: Mon Aug 19, 2013 1:22 am
Location: United Kingdom
Contact:

Rename String to Input

Post by nblackburn »

Rename the String gadget to Input as a string cannot be a control as it is traditionally a sequence of characters.
Image
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Rename String to Input

Post by STARGÅTE »

against!

"String" is the name of content of the gadget, like ImageGadget, DateGadget, TreeGadget, ...

In all gadgets you can input something, like values or events.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Rename String to Input

Post by PB »

> "String" is the name of content of the gadget, like
> ImageGadget, DateGadget, TreeGadget

Good rationalization. :)

nblackburn, PureBasic has macros for what you want. Macros
let you alter the language to what YOU desire. You can create
a macro to rename the StringGadget as easily as the below.
(Note: I've removed the Flags parameter for this demo).

Code: Select all

Macro InputGadget(Gadget, x, y, Width, Height, Content)
  StringGadget(Gadget, x, y, Width, Height, Content)
EndMacro

OpenWindow(0,100,100,300,100,"test")
InputGadget(0,20,20,200,20,"This is an InputGadget!")
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
Also, you really shouldn't request something that breaks all
existing code found on these forums and for everyone else.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Crusiatus Black
Enthusiast
Enthusiast
Posts: 389
Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:

Re: Rename String to Input

Post by Crusiatus Black »

Nathanial, let's not make PB into AMS! :p /jk
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!
User avatar
nblackburn
User
User
Posts: 67
Joined: Mon Aug 19, 2013 1:22 am
Location: United Kingdom
Contact:

Re: Rename String to Input

Post by nblackburn »

I have to say now I have spent more time with PB, I also think it sounds like a stupid idea, haha :P

P.S - AMS is generally pretty terrible for most things, why would I do that?
Image
User avatar
Crusiatus Black
Enthusiast
Enthusiast
Posts: 389
Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:

Re: Rename String to Input

Post by Crusiatus Black »

nblackburn wrote:I have to say now I have spent more time with PB, I also think it sounds like a stupid idea, haha :P

P.S - AMS is generally pretty terrible for most things, why would I do that?
Renaming it to Input is one step towards that... :p
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Rename String to Input

Post by BorisTheOld »

nblackburn wrote:I have to say now I have spent more time with PB, I also think it sounds like a stupid idea, haha :P
Don't start thinking like that, otherwise you'll close your mind to perfectly valid coding solutions.

PB is a powerful language that can be made to do things that "can't" be done. But it also has its limitations, so don't be afraid to push its limits if you feel that something isn't as it should be.

Macros are my preferred weapon of choice.

For example, I prefer to write:

Code: Select all

PrivateSubroutine(DvsML06, DD2765Attach) (ByVal(Me, strDvsML06))
  If NotObject(Me\proPanelDD2765)
    Me\proPanelDD2765 = CreateObject(PanelItem)
    Set(Me\proPanelDD2765, exoParent, Me\proAppPanel)
    Set(Me\proPanelDD2765, exsTabText, "Structures")
    SetCallBack(Me\proPanelDD2765, expCBDesign, DvsML06, DD2765Design)
    ObjectCall(Me\proPanelDD2765, Build) ()
  Else
    ObjectCall(Me\proPanelDD2765, Show) ()
  EndIf
EndSubroutine
rather than:

Code: Select all

Procedure clsDvsML06_subDD2765Attach (*Self.strDvsML06)
  If *Self\proPanelDD2765 = 0
    *Self\proPanelDD2765 = clsPanelItem_funCreate()
    *Self\proPanelDD2765\setexoParent(*Self\proAppPanel)
    *Self\proPanelDD2765\setexsTabText("Structures")
    *Self\proPanelDD2765\setexpCBDesign(1, @clsDvsML06_subDD2765Design())
    *Self\proPanelDD2765\setexpCBDesign(2, *Self)
    *Self\proPanelDD2765\subBuild ()
  Else
    *Self\proPanelDD2765\subShow ()
  EndIf
EndProcedure
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Rename String to Input

Post by luis »

I like pizza.
"Have you tried turning it off and on again ?"
A little PureBasic review
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Rename String to Input

Post by BorisTheOld »

luis wrote:I like pizza.
My food of choice is a Bedfordshire Clanger. :mrgreen:
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Rename String to Input

Post by ts-soft »

luis wrote:I like pizza.
I like bratwurst with sauerkraut and salzkartoffeln :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Crusiatus Black
Enthusiast
Enthusiast
Posts: 389
Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:

Re: Rename String to Input

Post by Crusiatus Black »

ts-soft wrote:
luis wrote:I like pizza.
I like bratwurst with sauerkraut and salzkartoffeln :wink:
Kartoffelsalat, Sauerkraut und bratwurst oder currywurst. ^^
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!
User avatar
nblackburn
User
User
Posts: 67
Joined: Mon Aug 19, 2013 1:22 am
Location: United Kingdom
Contact:

Re: Rename String to Input

Post by nblackburn »

BorisTheOld wrote:
nblackburn wrote:I have to say now I have spent more time with PB, I also think it sounds like a stupid idea, haha :P
Don't start thinking like that, otherwise you'll close your mind to perfectly valid coding solutions.
I haven't started to think like that at all don't worry, just on this occasion just after careful consideration I feel it makes sense they way it is and that it doesn't need to be changed. :wink:
Last edited by nblackburn on Mon Aug 26, 2013 2:04 am, edited 4 times in total.
Image
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Rename String to Input

Post by luis »

@nblackburn and to everyone interested really... a TIP

You can just use:

@BorisTheOld

instead of re-quoting his post entirely. Very rarely is needed.

This tip is especially directed to people quoting sometimes a 1+ screen long code to say "Nice!"

This is not just something cosmetic, or to save disk space, it also simplify forum's searches avoiding redundant results.

It's also logical IMHO (in a programmers' forum should be something cherished I hope).

To QUOTE is different from I_JUST_REPEAT_ALL_YOU_JUST_SAID_BEFORE_REPLYING_TO_YOU.

Would you do that in real life ?


*SIGH*
http://www.purebasic.fr/english/viewtop ... 66#p422866
http://www.purebasic.fr/english/viewtop ... 60#p422860
"Have you tried turning it off and on again ?"
A little PureBasic review
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Rename String to Input

Post by BorisTheOld »

luis wrote:@nblackburn and to everyone interested really... a TIP

You can just use:

@BorisTheOld

instead of re-quoting his post entirely. Very rarely is needed.

This tip is especially directed to people quoting sometimes a 1+ screen long code to say "Nice!"

This is not just something cosmetic, or to save disk space, it also simplify forum's searches avoiding redundant results.

It's also logical IMHO (in a programmers' forum should be something cherished I hope).

To QUOTE is different from I_JUST_REPEAT_ALL_YOU_JUST_SAID_BEFORE_REPLYING_TO_YOU.

Would you do that in real life ?


*SIGH*
http://www.purebasic.fr/english/viewtop ... 66#p422866
http://www.purebasic.fr/english/viewtop ... 60#p422860
+1 :wink:

And of course, anyone who quotes any of my long obtuse posts deserves to get flamed. :D
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Rename String to Input

Post by blueznl »

:lol:
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply