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.
#PB_Compiler_EnableXPSkin
#PB_Compiler_EnableXPSkin
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
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
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
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
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
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.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.
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.
Yes, but all the constants #PB_Compiler_xxxx are known by the developer.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.
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.
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).If you need those features of the listicongadget, why would you ever compile without themes?
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
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
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 :
why not also something like this :
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 !")
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
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
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.
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.
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
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer