Property value settings...

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
GypsyPrince
User
User
Posts: 20
Joined: Sun Apr 05, 2015 9:13 pm

Property value settings...

Post by GypsyPrince »

All properties in the PB library need some way to test or determine their current value.

For instance, EnableGraphicalConsole(State) turns the graphical mode on, but there is currently no means to test which setting it currently posseses.
Is my console in graphical mode or text mode?

When I get to a certain point in my code, I need to know what the value of this and others properties are in order to determine on which route to proceed with my subsequent procedures or methods. I can't depand on remembering whether or not I turned it (them) on.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Property value settings...

Post by Dude »

GypsyPrince wrote:there is currently no means to test which setting it currently posseses.
Since you're the only one who can set it, you already know what it is. Why can't you depend on that?
GypsyPrince
User
User
Posts: 20
Joined: Sun Apr 05, 2015 9:13 pm

Re: Property value settings...

Post by GypsyPrince »

I'm the only one who can eat my own food. Why would I settle for eating bread or crackers every day when there is the possibility to splurge and have a delicious steak?

Oh, I know... because realistically I have no actual need for such a property and just thought I would toss a random question into the air - just because.

Don't you think if that I didn't have a need for it, whether or not you understand that need, I wouldn't have asked for it? Again, can someone in these forums just answer questions directly and politely without the need for questioning the intentions of the asker, and without snide commentary?
juror
Enthusiast
Enthusiast
Posts: 228
Joined: Mon Jul 09, 2007 4:47 pm
Location: Courthouse

Re: Property value settings...

Post by juror »

GypsyPrince wrote:without snide commentary?
You mean like yours?
:D
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Property value settings...

Post by Danilo »

I agree, more functions could get a pair of Set/Get functions.
GypsyPrince
User
User
Posts: 20
Joined: Sun Apr 05, 2015 9:13 pm

Re: Property value settings...

Post by GypsyPrince »

Thanks, Danilo.

The gentleman (or gentlemen - I don't know any names) who created and maintain PureBasic obviously have a great deal of talent and expertise, far more than myself. So, I'm quite certain he/they have a valid reason for not creating the Set/Get compliments for each property, even if it is just that they haven't gotten around to doing it, or maybe even they don't want to. All I can do is politely make a suggestion, and they politely reply either yay or nay... LOL

PureBasic is a kick-ass program!!! 8)
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Property value settings...

Post by Tenaja »

juror wrote:
GypsyPrince wrote:without snide commentary?
You mean like yours?
:D
Uh oh. It is never good news to get the attention of a juror...

Anyway, GP, please do not be quick to discard comments like what Dude has said. We here do not know all of your capabilities, and forum text "tone" is easily misunderstood. Also, "we" often offer suggestions to workaround things posted on the wishlist that have not yet been implemented.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Property value settings...

Post by Dude »

GypsyPrince wrote:Again, can someone in these forums just answer questions directly and politely without the need for questioning the intentions of the asker, and without snide commentary?
My comment was not snide at all. It was a legitimate question as to why you can't depend on a setting that you personally set. Please educate me because I'm obviously missing some point.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Property value settings...

Post by Danilo »

When writing add-on commands and libraries, you don't know the current state of a 'property'
that was set by the programmer.
For example current drawing mode, and current drawing colors, etc.

Even when used directly, it frees you from maintaining many state variables.

Some possibly eligible candidates:

Code: Select all

Setter                      Getter
-------------------------------------------------------------------------
BackColor()                  ? GetBackColor
ClipOutput()                 ? GetClipRect
DrawingFont()                ? GetDrawingFont / GetDrawingFontID
DrawingMode()                ? GetDrawingMode
FrontColor()                 ? GetFrontColor

ConsoleLocate()              ? GetConsoleCursorLocation (GetConsoleMouseLocation?)
ConsoleTitle()               ? GetConsoleTitle
EnableGraphicalConsole()     ? GetConsoleMode
                             ? GetConsoleWidth  (in characters)
                             ? GetConsoleHeight (in characters)

LoadFont()                   ? GetFontName/GetFontSize/GetFontFlags

GadgetToolTip()              ? GetGadgetTooltip
HideGadget()                 ? IsGadgetHidden
DisableGadget()              ? IsGadgetDisabled

HideWindow()                 ? IsWindowHidden
DisableWindow()              ? IsWindowDisabled
StickyWindow()               ? IsWindowSticky

RotateSprite()               ? GetSpriteRotation
ZoomSprite()                 ? GetSpriteZoomX/Y
SpriteBlendingMode()         ? GetSpriteBlendingMode
SpriteQuality()              ? GetSpriteQuality
TransparentSpriteColor()     ? GetSpriteTransparentColor

DisableToolBarButton()       ? IsToolBarButtonDisabled

PauseThread()                ? IsThreadPaused
ThreadPriority()             ? GetThreadPriority


Reversing Object Number and Object ID (handle)
-------------------------------------------------------------------------
FontID                       ? FontFromID
GadgetID                     ? GadgetFromID
WindowID                     ? WindowFromID
...
In general: If you are able to set a state/mode/value, you should be able to get the current state/mode/value. ;)
sancho2
User
User
Posts: 44
Joined: Wed Apr 15, 2015 5:14 am

Re: Property value settings...

Post by sancho2 »

Adding one to Danillos list: IsMenuEnabled()
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Property value settings...

Post by Little John »

+1 from me.
That would be pretty useful, especially when creating libraries, as Danilo wrote.

A separate "Get" function is not always needed, the "Set" function often can return the current state, e.g.

Code: Select all

*previousErrorHandler = OnErrorCall(@currentErrorHandler())

[...]

If *previousErrorHandler <> #Null
   OnErrorCall(*previousErrorHandler)
EndIf
Post Reply