Page 1 of 1
#PB_Compiler_EnableXPSkin
Posted: Thu May 22, 2008 3:28 pm
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.
Posted: Thu May 22, 2008 3:29 pm
by Foz
*scratches head*
... why would you need that? I can't think of a reason for that at all...
Posted: Thu May 22, 2008 3:53 pm
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
Posted: Thu May 22, 2008 5:11 pm
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.
Posted: Thu May 22, 2008 5:28 pm
by Trond
If you need those features of the listicongadget, why would you ever compile without themes?
Posted: Thu May 22, 2008 6:43 pm
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).
Posted: Thu May 22, 2008 8:41 pm
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 !")
Posted: Sun May 25, 2008 2:44 am
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.
Posted: Sun May 25, 2008 7:51 am
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.