I have added
Protected
Overrides ReadOnly Property ShowWithoutActivation() As Boolean Get Return True End Get End Propertyto my "test form" and open it using a timer from my "Form 1" but if you keep typing into the text box on form 1 when test form opens the textbox on form 1 looses its focus...
It may be me doing somthing stupid so i have uploaded a test project so you can see exactly how i have done it :S
you can dowload it at http://www.officebroker.com/TestNoActive.zip

ShowWithoutActivation does nothing???
martind2112
Hi
Yes I did look at your test project and understand how you have done it. My point was that you can only change the value when the form is first created (because it is read only). As the property only has a Get procedure and no Set procedure it cannot be changed later on. So what is the point - just make it available in the form designer.
Dave
vien11
Woo yeah :D
Seemed to haev fixed it mate, thsi is how....
Kinder seems silly to me now that i expected the form that "had" focus to reselect the correct control in the correct staus by just giving it back the focus, so getting the current control first, then the form that had focus, then giving the form back focus and then giving the control focus :)
Dim ReFocusForm As Object
'====================================================Dim ReFocusControl As Object
Public Function ShowMessage() As Boolean
'== Check To See If the User Wants to See Messages
'==================================================== If GetSetting("OBv3", "Global Settings", "Popups") = "True" Then
ReFocusControl = ActiveControl
ReFocusForm = ActiveForm
Me.Show()MouseIn =
FalseFinishedDrawing =
FalseDrawTimer.Enabled =
TrueReFocusForm.Activate()
ActiveControl = ReFocusControl
Else Me.Dispose() End If End FunctionDaniel Schlößer
Nope, the only code that is tied to this textbox is
Private Sub QuickNoteTxtb_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles QuickNoteTxtb.Click
'===================================================
If QuickNoteTxtb.Text = "Quick Note" Then QuickNoteTxtb.Text = "" End Sub'== Clears the text of the Quick Note when entred
'===================================================
If you try it on that test application i have put up it should do the same thing to you too, there must be a simple way around this :(
Otherwise whats the point in puttin the option into the fraimwork, more anoyingly i have done it as per the MSDN example :(
http://msdn2.microsoft.com/en-us/library/system.windows.forms.form.showwithoutactivation.aspx
Clement Yuan
Sorry its been a hard day (already) and so it may be me being thick again but ShowWithoutActivation is a property of a windows .net 2 form and so you need to add an override like i have to be change the value of a protected property
Did u get a chance to download the text project i made so you can see exactly how i have doe it
AggieNut
Cadey
Don't know if you are still monitoring this old thread but I now know why this feature did not work for you.
It's because in your testform you had topmost set to True
If you change that to False you will find it works fine.
Dave
Marioh
Wow thanks mate!!!
Ill try it at work tommorow, the only thing i proberly did't try!!!
Doh :)
hokial
I can't imagine anyone has used it as like you have discovered it doesn't seem to work.
I really cannot see the logic in making a read only property overrideable. Why not just make it available at design time.
Dave
amc
I did try the workaround on your test project before I posted it and it worked fine - the text doesn't get selected and you can carry on typing with no interruption.
I doubt if there is a simple answer otherwise someone would have come up with it by now.
There is another thread running at the moment which also involves problems with selection of text in text boxes
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=253851&SiteID=1
I'm beginning to think the implementation of the text box in this framework is flawed or are we all overlooking something
Dave
Congi
It's not normal behaviour for a textbox to highlight all the text when it receives focus. You either have to double click on it or select it programatically.
Have you got any code in the textbox GotFocus event that could be causing this
Dave
jecottrell65
MattyMarsh
Kevin Bowker
I'm not suggesting there is anything you can do - the property doesn't appear to work. I was just wondering why MS did it this way instead of making it available in the properties of the form designer.
In the meantime the work around is quite simple.
Dim C As Control = Me.ActiveControl
TempForm =
New TestFormTempForm.Show()
Me.Activate()
C.Select()
but I'm sure you were already aware of that.
BTW - I think the reason why the override is needed is not because the property is protected but because it is read only.
Dave
SOYGAMA
ReFocusControl = ActiveControl
ReFocusForm = ActiveForm
and
ReFocusForm.Activate()
ActiveControl = ReFocusControl
Parts of the code, this is because it will cause a run-time error if there is no form or control in focus when it tries to give it back the focus :)
Ben Anderson MSFT
Cant quite use it in this way im afraid mate, as the pop-up (window) does not always open (the user can control if it does) so i tried it like this.
It did seem to work but if they are typing at the same time the window opens when the control (ie the textbox) gets focus back the words inside it all get highlighted and as you no if you hit a key when text is all highlighted it will over type it... quite anoying :(
The pop-up window code is in a global class tha compiles into a DLL and is called like this..
Public Function ShowMessageWindow(ByVal Subject As String, ByVal Message As String) As Boolean '========================================================================'==Load The Show Message Window With the Subject And Message Supplied '======================================================================== If Not IsService Then Dim TempWindow As OB3Global.MessageWindow
TempWindow =
New OB3Global.MessageWindowTempWindow.Subject = Subject
TempWindow.Message = Message
TempWindow.ShowMessage()
End If End FunctionThe show message function then does (or did, i took it off because of the above problem) this
Public Function ShowMessage() As Boolean '===================================================='== Check To See If the User Wants to See Messages
'==================================================== If GetSetting("OBv3", "Global Settings", "Popups") = "True" Then
'== This will remember the control that has focus befor this winow steals it!!!
ReFocusForm = ActiveForm Me.Show()
MouseIn =
FalseFinishedDrawing =
FalseDrawTimer.Enabled =
True'== Now the form has opened give the focus back to the control that had it befor.
Else Me.Dispose() End If End FunctionActiveForm = ReFocusForm
'== This is the part that gives the focus back, and if the user is typing into a text box
'== the text gets highlighted and the user over types when they has typed in
Hope this makes sence :D