#PB_Compiler_EnableXPSkin

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

#PB_Compiler_EnableXPSkin

Post by Flype »

It might be useful to check wether the app has been compiled with or without XP Style enabled.

#PB_Compiler_EnableXPSkin (purebasic syntax)

or

#PB_Compiler_EnableVisualStyles (.net syntax)

i know this is a specific OS feature but on others OS, it'll just returns always #False.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Post by Foz »

*scratches head*

... why would you need that? I can't think of a reason for that at all...
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

I must say it is not of an absolute use.
More, there's a custom constants system in the IDE that can be used for such requests.

But, well, just an example :

I need for a app to use ListIconGadget Groups feature which are only usable when XP Skin are enabled.
I search forum, and i found a code by Sparkie that perfectly fits.
Then, I made an include file to easily manage Groups in ListView.
I might need in my include to detect if XP Skin is enabled or not to initialize or not some API for ListView Groups.

Sparkie's ListView Groups code :
http://www.purebasic.fr/english/viewtopic.php?t=9380
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Post by Demivec »

Flype wrote:But, well, just an example :

I need for a app to use ListIconGadget Groups feature which are only usable when XP Skin are enabled.
I search forum, and i found a code by Sparkie that perfectly fits.
Then, I made an include file to easily manage Groups in ListView.
I might need in my include to detect if XP Skin is enabled or not to initialize or not some API for ListView Groups.
IMHO since you are compiling your source, you also know whether you have "XP Skins" (themes) in use. Why don't you yourself set a constant to the value you need.

Secondly, what if you are compiling on computer A (without themes) but you want to run it on computer B (with themes). Your method wouldn't work. The method I suggested could handle it though.

Thirdly, using your method, you compile it on the target computer (without themes) but before you run it you decide to enable themes. The program becomes confused (or simply looks ugly). In this case both your method and mine would probably fail. To solve this case would require a runtime check (not a compile-time check).

For the three reasons listed above I would think this is best handled by the programmer and not with an IDE constant.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

If you need those features of the listicongadget, why would you ever compile without themes?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

IMHO since you are compiling your source, you also know whether you have "XP Skins" (themes) in use. Why don't you yourself set a constant to the value you need.
Yes, but all the constants #PB_Compiler_xxxx are known by the developer.
All those constants are totally useless ? I guess no.
What i'm requesting is just one more constant. As it is an option in the GUI preference window, it would consistent to have it also as a constant, like the others options.
If you need those features of the listicongadget, why would you ever compile without themes?
because my app should run on two different environments for use only in my company, employees are the users. Envs are 1/ simple PC with XP 2/ Win2K3 Server using TSE remote sessions. So i compile a specific version when running on TSE sessions. This specific version is lighter by some aspects (memory/cpu consuption).
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

Maybe the listview group example isn't a good one but here is a small example that makes senses (imho) when the coder decide to warn about the fact the program needs to be compiled with a compiler option :

i use something like this when a program needs threadsafe :

Code: Select all

CompilerIf #PB_Compiler_Thread = #False
  MessageRequester("MyApp", "MyApp must be compiled with ThreadSafe option !" + Chr(10) + Chr(10) + "This Program will End !")
  End
CompilerEndIf

MessageRequester("MyApp", "Hello this is MyApp !")
why not also something like this :

Code: Select all

CompilerIf #PB_Compiler_EnableVisualStyles = #False
MessageRequester("MyApp", "MyApp must be compiled with EnableVisualStyles option !" + Chr(10) + Chr(10) + "This Program will End !")
End
CompilerEndIf

MessageRequester("MyApp", "Hello this is MyApp !")
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

My advise is to:
Always compile with the XP theme on.

And then:

1. Check whether the program is running on XP, 2003, or later.
2. Check if "Themes" is enabled.
3. Use the fancy stuff if both 1 and 2 are true.

Search the forums for info to detect whether Themes are enabled (should be some code here someplace I hope)
2003 usually does not have Themes enabled by default (that I can recall), I could be wrong though and it actually has Themes enabled. In that case just detect whether it is XP or 2003.
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

i tested yesterday the listview group feature on 2003 server, using TSE (remote desktop). and it works even if theme is disabled on the server. but of course, i must compile with xp skin support.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Post Reply