|
Hello,
fracalifa wrote per e-mail: Hi Martin,
tnx, that works, but how can I prevent the statechange of the radiobutton ? Is there a cancel option which I can use for?
Tnx Frank [confused]
I haven't even found "statechange", is it .NET>1.1?
P.S.: please respond in the forum, cause I'm not answering per e-mail!
All the best,
Martin
|
|
|
|
|
Hi Martin,
other than a checkbox a radiobutton is a group of controls. With the checkbox I can do suppressing the toggle of the state, with the radiobutton(s) I can do not.My wish is to prevent the change of state from uncheched to checked when clicking on it, that's all (without enable = false).
tnx Frank
|
|
|
|
|
But haven't you allready told the solution with overriding the OnClick.
I tested it with an inherited (from RadioButton) control.
private bool _disable = false;
public bool Disable
{
get
{
return _disable;
}
set
{
if(value!=_disable)
{
_disable = value;
}
}
}
protected override void OnClick(EventArgs e)
{
if(!Disable)
base.OnClick (e);
}
Works well for me.
All the best,
Martin
|
|
|
|
|
Yes, that's it,
my fault was the calling of the base class even when it is disabled.
tnx
|
|
|
|
|
Glad I could help!
You are wellcome!
All the best,
Martin
|
|
|
|
|
Hello there,
I have been asked to create a design surface where you can drag and drop controls onto this surface and it will automatically generate the XAML code , now the problem is i have never done this before, so if there is anyone who can help me with this it would be greatly appreciated.
thanks in advance
|
|
|
|
|
|
thanks for the reply,
im actually trying to create a custom IDE like VS that i can drag and drop controls onto a surface and the XAML code for those controls will be generated automatically,
|
|
|
|
|
Well yes, that's what Expression Blend does. It'll probably be cheaper to buy it than putting in vast amounts of time and trouble to create something similar.
Standards are great! Everybody should have one!
|
|
|
|
|
Expression Blend would work but we are looking to create a custom one that we can develop and deploy so that anyone can create a custom application simply by dragging controls onto a design surface
|
|
|
|
|
Hi,
I've created a timer object with these statements
private Timer stepTimer = new Timer();
stepTimer.Interval = 1000;
stepTimer.Tick += new EventHandler(stepTimer_Tick);
these statements are in my constructor.
when I call stepTimer.Start(); in the constructor it comes to the stepTimer_Tick method.
However, when I do that somewhere else (for example I am trying to call in another callback function)
it does not enter the function stepTimer_Tick.
I've taken the statement (stepTimer.Start(); ) to different locations but it is still the same. How can I solve that.
Thanks...
aysan ethem narman
|
|
|
|
|
Hello,
As you are using the Forms.Timer which is running in the UI thread, you have to be carefull when accessing it from an other thread.
In this case you have to invoke the method which calls the Timer like this.
private delegate void EnableTimerDelegate();
private void EnableTimer()
{
if(InvokeRequired)
{
Invoke(new EnableTimerDelegate(EnableTimer), new object[] {});
return;
}
if(!stepTimer.Enabled)
{
stepTimer.Enabled = true;
}
}
Invoke and InvokeRequired are members of Control.
Hope it helps!
All the best,
Martin
|
|
|
|
|
Hi,
Thank you very much it works.
Interesting thing is I've met cross thread operation many times before, I've caught them with try catch blocks and solved with invoke method as you did. However, this time it did not fire any exception although it is again in a try-catch block. So I did not doubt about this problem.
Again thank you...
aysan ethem narman
|
|
|
|
|
Hello,
alashara wrote: Thank you very much it works.
Glad I could help!
You are wellcome!
-- modified at 5:53 Thursday 12th July, 2007
I assume that you now don't work with this dirty try/catch blocks and use the InvokeRequired instead, at least I would suggest it!
P.S.: It's allways nice to read a "Thank you", like you did! Got my '5' for that!
All the best,
Martin
|
|
|
|
|
Hi,
to which try-catch block should an InvalidOperationException (the one that
fires on cross-thread sins) report when it occurs in a callback method
(i.e. one that does not include its own try-catch) ?
It just gets swallowed. There are a couple of situations where an Exception
seems to disappear, you wont notice unless you look very carefully...
UnhandledException got added in .NET 2.0 to improve on the situation.
|
|
|
|
|
Hi all,
Does anyone know how to change the computers short date format that is listed in the control panel (Regional and Language Options).
If anyone is thinking go into the control panel and change it... no... -.-;
I need to do it programmically!.
Cheers,
Mark
|
|
|
|
|
Haven't used that befor, but "kernel32.dll" provides a lot of usefull methods in this topic.
Like:
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct SystemTime
{
public short sYear;
public short sMonth;
public short sDayOfWeek;
public short sDay;
public short sHour;
public short sMinute;
public short sSecond;
public short sMilliSeconds;
}
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
public static extern bool SetLocalTime(ref SystemTime time);
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
public static extern bool GetLocalTime(ref SystemTime time);
Or:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TimeZoneInformation
{
public int bias;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string standardName;
SystemTime standardDate;
public int standardBias;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string daylightName;
SystemTime daylightDate;
public int daylightBias;
}
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern bool SetTimeZoneInformation([In] ref TimeZoneInformation lpTimeZoneInformation);
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern int GetTimeZoneInformation(out TimeZoneInformation lpTimeZoneInformation);
Maybe you are luky with kernel32?
All the best,
Martin
|
|
|
|
|
how we can access "protected internal" class?
vamsi
|
|
|
|
|
Sounds that this question is asked in the Interview?
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
Well there are a number of access qualifiers: private , protected , internal , and public .
protected means that only the class and anything derived from it has access.
internal means that only code in the same assembly has access.
Now, protected internal is a combination (union) of the two.
See here instead[^]
-- modified at 7:07 Thursday 12th July, 2007
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Wouldn't it be an intersection of the two? i.e. a class has to be in the same assembly AND and derived rather than OR?
Not trying to nit-pick, just curious
|
|
|
|
|
ruanr wrote: Wouldn't it be an intersection of the two? i.e. a class has to be in the same assembly AND and derived rather than OR?
As I remember it is a UNION. The class has to be in the same assembly OR derived.
See here instead[^]
-- modified at 7:08 Thursday 12th July, 2007
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
|
Actually, that makes it sound like you were right - and the poster below here agrees with your original opinion.
Who's bored enough to test it?
|
|
|
|
|
hi
The permissions allowed by this access level are those allowed by the 'protected' level plus those allowed by the 'internal' level. The access level is thus more liberal than its parts taken individually. This modifier should only be used for internal classes (ie. classes declared within other classes).
Rajendra Kumar Yerra
|
|
|
|