|
|
I want to be able to check which control the focus is moving to, when a particular control is losing the focus.
Bascially, I have a text box, that when you type into it displays an autocomplete list. If the focus is moving away from the text box to some other control, I want to hide the list. However, if its moving TO the list, then obviously it needs to stay shown.
There doesn't seem to be anything in the .Net events that indicate where the focus is moving. Is there perhasps a message I can send that discovers it?
Thansk in advance
phil
-- modified at 0:23 Thursday 24th August, 2006
Thanks for all your non-replies I seem to have found out how to do it..
The easiest way is to in the OnLostFocus event handler, to first call the base.OnLostFocus. When control returns to your code, whichever control the focus has moved to will now have its .Focused property = true.
<br />
protected override void OnLostFocus(EventArgs e)<br />
{<br />
base.OnLostFocus (e);
if (!autoCompleteBox.Focused)
autoCompleteBox.Hide();<br />
}<br />
Regards,
Phil
|
|
|
|
|
If you just want to hide/show the autocomplete list, you can use
event Enter and Leave from the textbox to detect GotFocus/LostFocus
|
|
|
|
|
Hello
Well! I was just typing that answer when you modified your post!!?
Anyway, I still want to add that if you are using .Net 2.0, you should use the TextBox.AutoCompleteSource property instead, which is a built in AutoComplete.
Regards
|
|
|
|
|
Hi Nader,
Yes, unfortunately this does for now need to be supported in .Net 1.1, and I don't really want to maintain two code bases.
Thanks for your reply though.
Regards,
pk
|
|
|
|
|
I've looked everywhere. I've played with the Microsoft SGML component. I've played with the .NET wrapper of the COM wrapper of Tidy HTML. I've even thought of porting my 10 year old C++ HTML parser and correcter I wrote while bored over to C#.
But I'd rather just beg, borrow or steal (or even, and I'm this desperate) buy a .NET component That Just Works.
Does anyone have any recomendations?
|
|
|
|
|
|
They both use SGMLReader, and unfortunately the implementation as it's provided HTML-encodes already encoded HTML entities within PRE tags.
ie
<pre>
>
</pre> Comes out as
<pre>
&gt;
</pre> I'm beyond patience with trying to cobble together bits and pieces. I just want a simple, effective, efficient, thread safe component with one method:
public string HtmlCleaner.ConvertHtmlToXhtml(string inputHtml);
It's gotta be out there somewhere...
|
|
|
|
|
|
I appreciate the thought but you've just demonstrated the issue at hand: if you're looking for a .NET component to convert HTML to XHTML then you're very, very limited in your choices.
I'll just slap SGMLReader into shape.
|
|
|
|
|
|
I think Html Agility Pack is related to the one at eggheadcafe, it handled the entities ok but other than a quick test I haven't used it.
|
|
|
|
|
is it possible.........!
George Batres
|
|
|
|
|
To a point. Mono is what you need, google Mono Linux and you'll find all the info you need.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Yes. As Christian said you can use Mono, or you can port your .NET code to J2EE (and continue to write and debug in your .NET language) using Grasshopper from Mainsoft[^]
|
|
|
|
|
i prefer to know that in c# only what is the classes in .net that access hardware of the pc
George Batres
-- modified at 21:03 Wednesday 23rd August, 2006
|
|
|
|
|
If you google for C# USB, you'll find there is no direct support ( I believe ), but some helper classes exist that use p/invoke.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
Pretend myControl inherits from System.Windows.Forms.Control.
I'm trying to set myControl.BackColor to Color.Transparent in myControl's constructor so I can see stuff I've painted behind it. When I uncomment this command, the program hangs at startup (right at that line).
What's wrong with what I'm trying to do? Is it waiting (or looking) for something?
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
Instead of setting the background color to Color.Transparent in the constructor, I tried setting it to Color.FromArgb(0,0,0,0), which I've heard is transparent also (because of the 0 for Alpha). That didn't work either.
When I removed that line from the constructor and put it in a button event handler, after clicking the button, it gave me an ArgumentException, saying, "Control does not support transparent background colors."
I want to have a number of controls at dynamic locations on a panel, and be able to see through one control to another (the "controls" should just be a center dot and a circle inscribed in the control's bounds--hence, I want to be able to see one control's ring through another overlapping control).
Can someone please point me in the right direction? Should I be using a different base class (other than Control)?
I don't want to just paint to the parent panel, I want to actually have controls of some kind on the panel...
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
Hello
I've just done that and it throws an exception:
System.ArgumentException was unhandled
Message="Control does not support transparent background colors."
Regards
|
|
|
|
|
This is pure genius. You need to derive a class from the control type, so you can call SetSTyle ( a protected method ) and set the AllowTransparentBackground style ( or something like that ).
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I'll check that out. Thank you, Nader and Christian!!
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
I did a little reading. For what I want to do, it won't quite work because MSDN says this:
Note:
If there is another control between the control
and its parent, the current control will not
show the control in the middle.
MSDN says it's because it's not a real transparency... it's the control asking its immediate parent to draw itself onto the control (simulating transparency), but ignoring other possible controls between the control and its parent.
Oh, well. If it weren't for the fact that I need to see through all the controls (not just the panel under one control), it would be fine.
I might just have to draw to the panel after all (instead of adding controls to the myPanel.Controls collection).
Thanks anyway! At least I learned why it was throwing an ArgumentException!
-- modified at 0:56 Thursday 24th August, 2006
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
Hello,
I implemented drag and drop for some of my controls. I did it by having my controls implement IDataObject then using the usual mouse(up,down, move, etc) and drag(drop, leave, etc) events, in other controls/forms to accept the drop.
While the control is being dragged its shown along with the mouse as a small square border with a small + sign next to it (I guess this is default). It looks like the small box is the representation of the control being dragged. I would like to show sometime else as the control is being dragged. I've been looking on MSDN and online and didn't find anything yet (they only talked about how to replace the mouse cursor for the drag operation).
I really would like to avoid creating a form and moving that around with the mouse. Is there some handle to replace the default "object being dragged" state/box with something of my own choice.
Thanks,
Ramanan
"One of the Georges," said Psmith, "I forget which, once said that a
certain number of hours' sleep a day--I cannot recall for the moment how
many--made a man something, which for the time being has slipped my
memory."
|
|
|
|