Setting the console application text before the cursor - c#

In Console Applications how do you set the text before the cursor?
For those who may have worked on ArcInfo Workstation a command line application, they had different modules and depending on the module you work in the command line would change to show the different modules. e.g.
GRID:\>[Cursor here.]
GRID:\>TIN [Enter Key Press]
TIN:>[Cursor here.]
The Title property and WriteLine() methods are well known but how do you set the text before the cursor?

Console.WriteLine() sets your cursor on the next line, while Console.Write() - doesn't.
Hope that helps!

Related

Enter in text editor set cursor at begin of line instead of tabs

I have a strange behaviour with VS2015.
In C# code (the file is .cs) when I hit the enter, the cursor will always begin on position 0 of the next line. No tabs will be inserted to push the cursor to the same position of the previous line where code started.
public class Fake
{
public void Test() (here I hit enter)
{ <-- no tabs are automatic inserted before {
}
I have done: repair VS2015, Reset user Environment settings VS.
Someone an idea to reset the behaviour to default C# text editor?
Find the parameter - /ResetUserData - which Removes all user settings and makes you set them again. From http://msdn.microsoft.com/en-us/library/bb245788%28v=vs.80%29.aspx#vs05idetips_topic6
I got a similar issue here and it was about files.autoSaveDelay setting.
Issue:
After breaking line my cursor does go to the right indentation but after 1 sec goes straight to the beginning of the current line.
Cause:
So it happens because VSC (Visual Studio Code) erases any tab or spaces within a line if there is only these type of chars.
Solution
What you can do in order to solve it is either set a higher delay to files.autoSaveDelay or disable files.autoSave.

UITextView - InsertText doesn't auto-correct or auto-capitalize

I have a custom InputView on a UITextView with auto-correct and auto-capitalization turned on.
My custom input view has a bunch of UIButtons that call InsertText on the UITextView. This works fine for inserting text at the current cursor position. The problem is that auto-correction and auto-capitalization do not work when InsertText is called. If input comes in through a bluetooth keyboard, or the standard keyboard, everything works fine.
Is there some method I can call on UITextView to invalidate auto-correct/auto-capitalization? SetNeedsDisplay was my first attempt, but it had no effect. Also, my app may potentially be iOS 7 and higher, so it's fine to use newer text APIs.
*NOTE: I'm using MonoTouch (Xamarin.iOS), but Objective-C answers are welcome.
Not without rolling your own autocorrect system. The iOS autocorrect system is opaque to developers, and only works on keyboard input. Any time you explicitly set the .text property on an input or text view, the value you set is what will appear.
Ok, I found a way in which this works:
Implement your own NSTextStorage
Setup an NSLayoutManager and NSTextContainer to coordinate your NSTextStorage with UITextView
When programmatically modifying your NSTextStorage subclass, auto correct "just works"
I think this works because modifying NSTextStorage fires events that notify the UITextView to update things like autocorrect. It works only on iOS 7 and higher.

Visual Studio: How to show Overloads in IntelliSense?

Once code has been written, the only way I know of to view the overloads for a method is to actually edit the method by deleting the Parenthesis () and reopening them.
Is there a shortcut key that I could press to activate this instead of having to edit my files?
For an example, please reference the ShowDialog Overload screen shot below:
With your cursor inside the parentheses, use the keyboard shortcut Ctrl-Shift-Space. If you changed the default, this corresponds to Edit.ParameterInfo.
Example:
Ctrl+Shift+Space shows the Edit.ParameterInfo for the selected method, and by selected method I mean the caret must be within the method parentheses.
Here is the Visual Studio 2010 Keybinding Poster.
And for those still using 2008.
Tested only on Visual Studio 2010.
Place your cursor within the (), press Ctrl+K, then P.
Now navigate by pressing the ↑ / ↓ arrow keys.
The default key binding for this is Ctrl+Shift+Space.
The underlying Visual Studio command is Edit.ParameterInfo.
If the standard keybinding doesn't work for you (possible in some profiles) then you can change it via the keyboard options page
Tools -> Options
Keyboard
Type in Edit.ParameterInfo
Change the shortcut key
Hit Assign
It happens that none of the above methods work. Key binding is proper, but tool tip simply doesn't show in any case, neither as completion help or on demand.
To fix it just go to Tools\Text Editor\C# (or all languages) and check the 'Parameter Information'. Now it should work
Great question; I had the same issue. Turns out that there is indeed a keyboard shortcut to bring up this list: Ctrl+Shift+Space (a variation of the basic IntelliSense shortcut of Ctrl+Space).
The command Edit.ParameterInfo (mapped to Ctrl+Shift+Space by default) will show the overload tooltip if it's invoked when the cursor is inside the parameter brackets of a method call.
The command Edit.QuickInfo (mapped to Ctrl+KCtrl+I by default) will show the tooltip that you'd see if you moused over the cursor location.
I know this is an old post, but for the newbies like myself who still hit this page this might be useful.
when you hover on a method you get a non clickable info-box whereas if you just write a comma in the method parenthesis the IntelliSense will offer you the beloved info-box with the clickable arrows.
Every once and a while the suggestions above stop working, if I restart Visual Studio they start working again though.
you mean's change overload.
just Press Shift + ↑ / ↓
Mine showed up in VS2010 after writing the first parenthesis..
so, prams.Add(
After doings something like that, the box with the up and down arrows appeared.

selenium c# nunit problem getting focus off a textbox

I am testing a web app where a file is to be renamed as follows
1)first click on the files name
2) this will make a textbox appear
3) I type the new name in textbox
4) I have to click outside the textbox so that the new name gets set.
or
4) Press enter key
The problem is in step 4. I've tried to get it to click at several places in my app, but the textbox doesn't loose focus and hence the name doesn't get set. I've even tried to use focus command, but, in vain.
Also tried to do this with enter key, but, seems that it doesn't work too. I tried keypress, keypressnative, etc. nothing seems to work.
Note: this sequence works when I do it manually and doesn't work when I do it from IDE or RC for C#.
Any help in this direction??
Thanks,
Vamyip
Selenium does not always fire the proper events. Probably your application relys on the blur event of the text box?
Try
selenium.fireEvent(locator_for_textbox, "blur");
Capybara throws an error because the driver does not support 'blur'
So I use:
find('html').click

Five Questions regarding the use of C# / VisualStudio 2005

I've some questions .. and I really need your help.
I have an application.
First I display a splash screen, a form, and this splash would call another form.
Problem: When the splash form is displayed, if I then open another application on the top of the splash, and then minimize this newly opened application window, the splash screen becomes white. How do I avoid this? I want my splash to be displayed clearly and not affected by any application.
I'm using a DropDownList but I realized that there is 2 types of it . I found "Dropdown" which makes the text inside the DDL editable, and "DropDownList" which doesn't.
Problem: when I tried to use DropDownList control it doesn't allow me to add a default text while DropDown does so I want a DropDownList control which prevent modifying on the text and allow a default text .. what property should I use?
Can I add "?" which denotes to Help button to the FormBorder (with the minimization, maximization, and close buttons )
Can I change the colour of the Formborder from its default colour (blue) ?
One of my application functionality is to copy files from server to phone into a certain folder in memory card.
Problem : can I determine the free size of the MMC to notify the user if it's full while copying.
3) You have to set the "HelpButton" property of the form to true. However the "?" button is only visible if you deactivate the maximize and minimize buttons by setting "MinimizeBox" and "MaximizeBox" to false.
Here are a few...
1) you need to launch the window in another thread so that your app can do what it needs to do to start. When the startup finishes, signal to the splash screen that it can close itself.
2)
dropDownList.SelectedIndex = 0;
4) I would not recommend doing so. It is based on the system color scheme, which the user sets. I would not like an app to decide for itself which scheme to use.
5) if the MMC shows up as a mapped drive you could use one of these techniques
Once again there is no answer to this guys question.
Yes, do as the other guy said and launch the splash screen in its own thread.
There is only one type of ComboBox in .Net, However there is a property called DropDownStyle which sets its functionality.
Yes, I am clueless on how this one works and never needed it.
Yes you betcha, Its called non-client painting. you can find more info on it here http://www.codeplex.com/CustomerBorderForm/Wiki/View.aspx?title=Painting%20NonClient%20Area&referringTitle=Home
I Need more details on this.

Categories

Resources