|
Look at the CultureInfo class, not sure if u can change it though
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
As far as I can tell, you can only use this class to change on a per thread basis, I need to change window's locale programatically (like when using the regional settings control panel applet, or the win32 API's)
Thanks leppie. Anyone else knows?
|
|
|
|
|
Set Thread.CurrentUICulture to the desired CultureInfo . If you have controls that have already been initialized, you'll have to re-initialize them (note, not necessarily reinstantiate them) with a ResourceManager to have the new culture's information read from the satellite assemblies. If Windows's regional settings specifies a different culture for the UI, this all happens by default using the selected language, if available. Otherwise, the ResourceManager resorts to the neutral resources language (the localized resources in the assembly that contains your code). You should use the assembly attribute, NeutralResourcesLanguageAttribute , to keep the ResourceManager from making unnecessary look-ups for satellite assemblies for the culture that is already included in your primary assembly.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks heath but... I already know all this. Again, I need this application to change the system's locale. I know this will not change the locale of running processes, but will determine the locale of new ones. This is what I need - this little applet is for performing a repetitive testing operation we need to do in several locales. About which locale this applet runs in... I don't care! It is not even localized. The app I am using to test of course is.
I am currently calling a C++ DLL which does the correct calls kludgy! (SystemParametersInfo with SPI_SETDEFAULTINPUTLANG)... kinda works but I want to know if there is something in the FCL to do this.
Thanks,
Juan Miguel Venturello
|
|
|
|
|
Juan Miguel Venturello wrote:
I wan't to know if there is something in the FCL to do this.
I somehow doubt that they would give a bunch of GUI programmers that liberty
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
So, basically, same as so often, use API's because FCL does not offer everything you need...
I know the concept goes way beyond this, but sometimes the FCL just seems like another wrapper around the API's which, to do some things, you need to call directly. Good old API's, glad I learnt them. Same story as VB programmers wanting to do things, having to call API's and getting all confused because they have no idea what an API, handle, etc, is....
Sure the framework/clr offers a ton of interesting things and makes things much easier, but why only offer a subset of the functionability of the API, not all? (like in this case). To make it portable to other platforms???!?
Whatever, thanks for taking time to reply.
Juan
|
|
|
|
|
It's supposed to be a wrapper. The ability to P/Invoke makes framework extensible, although not portable as you mentioned. I haven't checked yet, but I'm betting Mono does support P/Invoked calls, albeit in a different library. I'm not defending this design, just mentioning that Microsoft has been very clear about this. It's not another Java - similar concept, different implementation. The JVM takes care of all the OS-specific operations, but the CLR is meant only to manage the objects and provide interoperability services. It sure beats JNI! (Trust me, I know). I guess you could say that they really differ most on how they handle native calls and both have advantages and disadvantages in the way they handle them.
Also, sorry I didn't notice that you said "system locale" in your first post. I read the thread before I posted originally and guess it just completely slipped my mind.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
while(sReader.ReadLine()!=".")
{
retrMessage.Add(sReader.ReadLine());
}
sReader , my StreamReader reads a network stream from a POP3 server one line at a time and adds it to my array retrMessage[] .
Well, at least... it DID. I changed retrMessage from a string[], to an ArrayList. And now for some reason, only every other line is stored into the ArrayList (it skips lines).
Um, I'm assuming that this is an arraylist problem, because the string[] was handling it fine.
Does anybody have some inside on what's going on, and how I can fix this?
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote:
while(sReader.ReadLine()!=".") { retrMessage.Add(sReader.ReadLine()); }
That code is just wrong, I'm not gonna even read the rest, try spot the mistake!
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
|
Hint: When you do a ReadLine the stream advances.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
So, this is a StreamReader problem...? I though it had to do with the ArrayList... hmm...
/\ |_ E X E GG
|
|
|
|
|
Yes, it's the StreamReader (actually, any stream or reader), but it's not a problem. This is the behavior of any IO on every platform I'm familiar with. You read, the cursor advanced.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
No! It's a logical error!
Step 1: You read a line and check if it is not "."
Step 2: You read a line and add it to the arraylist.
So you have to ask yourself one question, what happened to the string in step 1 if it wasnt "."?
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
ohhhhhhhhh.
I see, let me mess with it.
/\ |_ E X E GG
|
|
|
|
|
string feed=null;
while(feed!=".")
{
feed=(sReader.ReadLine());
retrMessage.Add(feed);
}
There it is. I hope you had fun laughing at me.
/\ |_ E X E GG
|
|
|
|
|
leppie wrote:
That code is just wrong, I'm not gonna even read the rest
- Nick Parker My Blog
|
|
|
|
|
Could anyone point me to a multiline (text of an item can be displayed on multiple lines) listview Windows Forms control?
Thanks
|
|
|
|
|
Trying searching[^] first. There's a ton of examples of this on CP alone, besides what the link above provides. It's just an owner-drawn ListView which is trivial to do. You could also google for it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks, but I searched first and then asked for help.
|
|
|
|
|
Do you need a ListView or a ListBox ? The samples that are available are vastly different, and owner-draw ListBox examples are far more plentiful because they provide managed support for owner drawing, where a ListView requires that you override a hell of a lot of Windows messages and handle many different notification messages.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I need a ListView control.
|
|
|
|
|
At this time, there isn't many articles on CodeProject about this. There was one, but the guy used CodeProject as a testing front for what he later turned commercial.
To know what you need to do, research the Windows Common Control ListView. There are messages and notifications that you must be familiar with. After this, you override WndProc in your ListView derivitive class and handle those notification messages. You'll probably also have to P/Invoke several methods (especially SendMessage ) and create constants that represent message ID, and several structs.
You can try googling for an example, too.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
|
Carlos, just curious if you plan to continue posting your articles here, they are always full of great information and a great learning tool.
- Nick Parker My Blog
|
|
|
|