Poll: Unseen is crazy...
You do not have permission to vote in this poll.
Defo...no doubt...
100.00%
1 100.00%
Defo again - but he may actually be on to something here...
0%
0 0%
Total 1 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arbitrary CONST values
#1
Again as with me it's kinda spurious to most but, 

CONST ScrnW& = _Desktopwidth

and a few other ideas have led me to ask...is it possible? Worthwhile(above a shared variable or constantly refencing _destopwidth)? 

Or am i just crazy?

john
Reply
#2
I think this would be a crazy idea, as _DeskTopWidth isn't set in stone like CONST is.   Maybe on *your* system, it never changes, but on my setup I tend to have:

laptop at 2048 x 1200 resolution
TV at 4096 x 2400 resolution
second monitor at 1920 x 1024 resolution

So I can start a program on the laptop screen, then grab it with the mouse and drag it left/right to the next screen and... my original desktop width isn't my current desktop width.  Since such a command is usually involved with scaling, by making it CONST, I've now doomed my program to never scale.  It's too small to read on my tv and interact with.  Too large to fit my second monitor.

It really just ruined the entire point of the command.   Much better to:

Dim Shared As Long ScreenW 
ScreenW = _DesktopWidth

Then, you can periodically check to see if that width has changed and respond to it properly inside the program.
Reply
#3
I don't understand the question. Every QB64 coder that has been stung by the bug is crazy!

I dont like mixing functions with constants, too many bad memories, old programs still have color screwed up!

Whats a defo again?
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#4
(10-25-2025, 11:41 PM)SMcNeill Wrote: I think this would be a crazy idea, as _DeskTopWidth isn't set in stone like CONST is.   Maybe on *your* system, it never changes, but on my setup I tend to have:

laptop at 2048 x 1200 resolution
TV at 4096 x 2400 resolution
second monitor at 1920 x 1024 resolution

So I can start a program on the laptop screen, then grab it with the mouse and drag it left/right to the next screen and... my original desktop width isn't my current desktop width.  Since such a command is usually involved with scaling, by making it CONST, I've now doomed my program to never scale.  It's too small to read on my tv and interact with.  Too large to fit my second monitor.

It really just ruined the entire point of the command.   Much better to:

Dim Shared As Long ScreenW 
ScreenW = _DesktopWidth

Then, you can periodically check to see if that width has changed and respond to it properly inside the program.
So for you, when _DESKTOPWIDTH is called then...it depends on the screen your rendering on! Imagine you launched program on your small screen and then Alt Entered, moved it across to you tv/other panel and the screen you've moved it to has a different res...the initial width, height, aspect ratio etc would suddenly change! AND I agree it's a mess as this is not a problem i haven't encountered! 

BUT my reasoning....IF Aspect ratio or pixel size is calibrated against a "i made it to work on this res" but you can support this...then(again for me its probably relevant only...) a custom Aspect Ratio and/or scale values may be useful...and apparently referencing CONST is twice as fast as referencing variables....and you know me FPS is KING!

Thanks

Unseen

@bplus : "DEFO" is short for definitely!
Reply
#5
You English mates!

If something is definite how can it be definite again? And where is that o coming from? 

Sorry feeling a little peculiar tonight.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#6
(10-26-2025, 12:15 AM)bplus Wrote: You English mates!

If something is definite how can it be definite again? And where is that o coming from? 

Sorry feeling a little peculiar tonight.
Just for @bplus This is how i actually talk 

"Ello son, a'right?" "Whats good, anfing appenin?" "Shout me on the dog later as i gotta go me old mans then ill be down the rubber!" 

And is only DEFINIATE when the program starts...as we have agreed, resolutions are variable and (again for me) Width/height/ratios etc ARE constant IN your system so why cant i assign a value from the DESKTOP values? Surely they themselves are constants?

Me

John

p.s

Quote:Sorry feeling a little peculiar tonight.
All good here bro! I got big love for you so dont stress! My best questions are when im half drunk!

John
Reply
#7
(10-26-2025, 12:26 AM)Unseen Machine Wrote:
(10-26-2025, 12:15 AM)bplus Wrote: You English mates!

If something is definite how can it be definite again? And where is that o coming from? 

Sorry feeling a little peculiar tonight.
Just for @bplus This is how i actually talk 

"Ello son, a'right?" "Whats good, anfing appenin?" "Shout me on the dog later as i gotta go me old mans then ill be down the rubber!" 

And is only DEFINIATE when the program starts...as we have agreed, resolutions are variable and (again for me) Width/height/ratios etc ARE constant IN your system so why cant i assign a value from the DESKTOP values? Surely they themselves are constants?

Me

John

p.s

Quote:Sorry feeling a little peculiar tonight.
All good here bro! I got big love for you so dont stress! My best questions are when im half drunk!

John
   No the DESKTOP values ARE NOT constants.    They may always be the same on your system but they have to be determined by the code at Run Time.

CONSTANT's in someones code must be known at COMPILE time.     Any parameter that is system dependent or can change on the same system between program runs can NOT BE A CONSTANT ! .
Reply
#8
Is a person crazy for having a wild idea, hell no! I just watched 4 part interview with R Feynman. Our best science breakthroughs come from wild ideas. It's when none of the old methods of understanding a process work that wild ideas need to be entertained.

Is setting a Constant for screen width set to _DeskTopWidth a crazy idea, no kinda sensible but it makes assumptions how a user sets up and uses their screen tools.

I wouldn't do that because my taskbar is sometimes on right side (more room horizontally than vertical).
I like access to task bar though I'm coming to appreciate the Windows button for dropdown "Task bar" functions.

Also quite sane for testing ideas at forums, sorry @Unseen Machine you will have try harder if you want a "crazy" diagnosis from me Smile

Now if you want to know who I think might really be crazy...    well enough said for now LOL!
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#9
Quote:...snip...

CONSTANT's in someones code must be known at COMPILE time.     Any parameter that is system dependent or can change on the same system between program runs can NOT BE A CONSTANT ! .
Just a thought:

If I have a program that needs to remember the date and time when the program started, that is a CONSTANT for the specific run of that program.

The "run start date and time" value is different for every run, but it is constant within one run, and is never known at compile time.
Reply
#10
I agree a varaible can be called Constant and the keyword used if during a run, it remains unchanged.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Upcoming changes to CONST may affect your code SMcNeill 14 2,690 12-30-2023, 05:13 PM
Last Post: Kernelpanic
  TYPE and CONST within SUB/FUNCTION TerryRitchie 9 1,936 07-11-2023, 01:22 AM
Last Post: bplus
  suggestion: initialize array values within the DIM statement bobalooie 19 3,302 12-22-2022, 06:46 PM
Last Post: Kernelpanic
  Convert IPv4 dotted quad into four decimal values bert22306 6 1,522 10-31-2022, 03:30 AM
Last Post: bert22306
Bug Color CONST Warning v1.5+ bplus 3 796 05-05-2022, 06:13 PM
Last Post: Pete

Forum Jump:


Users browsing this thread: