Page 1 of 1

Property value settings...

Posted: Tue Apr 07, 2015 1:32 am
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.

Re: Property value settings...

Posted: Tue Apr 07, 2015 11:28 pm
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?

Re: Property value settings...

Posted: Tue Apr 07, 2015 11:44 pm
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?

Re: Property value settings...

Posted: Wed Apr 08, 2015 12:06 am
by juror
GypsyPrince wrote:without snide commentary?
You mean like yours?
:D

Re: Property value settings...

Posted: Wed Apr 08, 2015 1:20 am
by Danilo
I agree, more functions could get a pair of Set/Get functions.

Re: Property value settings...

Posted: Wed Apr 08, 2015 1:38 am
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)

Re: Property value settings...

Posted: Wed Apr 08, 2015 3:30 am
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.

Re: Property value settings...

Posted: Wed Apr 08, 2015 3:43 am
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.

Re: Property value settings...

Posted: Wed Apr 08, 2015 6:36 am
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. ;)

Re: Property value settings...

Posted: Sat Apr 18, 2015 3:17 am
by sancho2
Adding one to Danillos list: IsMenuEnabled()

Re: Property value settings...

Posted: Sat Apr 18, 2015 4:55 am
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