I have a question regarding the Haxe code. I try to use the quote as an input but it does not seem to work.
if (Input.getKeyboard().down("\'")) {
trace("TEST");
}
however when I use something like
if (Input.getKeyboard().down("\\")) {
trace("TEST");
}
When I press the \ button it works.
When I output the single quote as such:
var quote="\'";
trace(quote);
The output comes out correct as '
If anyone has insight as to why it does not work I would apreciate the help!!!
Thank you!
Related
I'm adding keyboard shortcuts to a Flutter web application.
I have a form within a custom FocusableActionDetector where the shortcut has form like this:
SingleActivator(LogicalKeyboardKey.digit2)
and action is like:
CustomActivateIntent: CallbackAction<CustomActivateIntent>(
onInvoke: (intent) { provider.value = "2"; },)
In the same form I have a couple of numeric TextFormFields. To permit writing the character "2" I have to put these text fields inside some new FocusableActionDetector, otherwise the previous detector catches the command and the text field loses the "2" character, and this is already quite weird... Moreover, after writing in any of the text fields the form focus detector doesn't work anymore.
I think this could be related to the focus system, which is yet not that clear to me.
Can anyone help find a clean solution?
I found a workaround: the FocusableActionDetector is now preceded by an if statement. The code looks like the following:
// I extract the form to a widget to make it clearer
var searchWidget = SearchWidget();
child: textEditingInProgress
? searchWidget
: FocusableActionDetector(
child: searchWidget,
...,
),
The textEditingInProgress bool is a field in a provider and is controlled by the FocusNodes belonging to the TextControllers.
Still this is not a perfect solution, in particular I'd like to understand why the previous approach was not working.
I find that in vs code I can start to type console.log I can leverage intellisense to auto complete the console.log and the cursor is inside the parentheses. However, after typing what to log I still have to either continue to type the closing parentheses or use the right arrow to put me at the end of the command. Is there a plugin so that I don't have to do that? Thanks.
console.log('hello');
^ after this I have to right arrow to the end of semicolon
Not sure which language but Typescript automatically comes with a snippet completion that does this. Just type 'log' and choose the snippet completion that pops up. After typing your log message you can hit Tab to go to the next line.
If your language doesn't have this or you want to customize the snippet you can create your own snippet completions.
https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets
If you look at the Typescript/Javascript snippet json it even has the code example for the console.log snippet completion.
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
When creating your own snippets I like putting short categories in the prefix itself.
So if you created your own snippet based on the above, the prefix would be:
"sn fn clog" (Note the spaces)
So you would prepend all your user defined snippet prefixes with 'sn '. That way if you type 'sn ' , you'll see all your custom completion pop up in the completion window. If you type 'fn ' , you'll seen all function custom snippets. Typing 'clog' will just pop up the correct custom logging snippet for you.
I am currently updating the bootstrap source less files for a project and I have to modify the hover state for the buttons. The end goal is something along these lines:
.btn-primary {
.buttonBackground(#btnPrimaryBackgroundHighlight, #btnPrimaryBackground);
&.hover {
.buttonBackground( lighten(#btnPrimaryBackgroundHighlight, %20), lighten(#btnPrimaryBackground, %20));
}
}
However, that returns a compile error. Any thoughts on this issue? I'm sure it's something simple, but I'm at a loss. Thanks in advance.
P.S. - I will also be using the :hover pseudo-class, but for sake of example I'm using a simple class.
Put the percent sign after the number (20% instead of %20)
im searching the best way for Printing a whole form / Several Datagridviews and some Specific controll contents in my WindowsForm application.
I know the internet is full with bad and good examples.
Its hard to separate the Good examples from the Bad examples.
So what can you reccomend me?
Whats your way to do this? Wich Examples in the Web are useful?
Thanks in advance
Try this code. This will print all the contents of the current form.
using (Bitmap bmp = new Bitmap(this.Width, this.Height))
{
this.DrawToBitmap(bmp, this.ClientRectangle);
using (PrintDocument p = new PrintDocument())
{
p.PrintPage += (o, pe) =>
{
pe.Graphics.DrawImage(bmp, this.ClientRectangle);
};
p.Print();
}
}
Sorry I didn't tested it.
you could create a snapshot from the form you want to print and then print the image.
For creating snapshots you could have a look here
I have a form text field that is being populated with a default value. I would like to clear the value and enter white space to assert that the expected validation occurs. I am using Selenium RC and the PHPUnit Selenium extension. How can I achieve this?
Note: I have already tried doing these, but they do not work:
$this->type('FirstName', " "); //spaces
$this->type('FirstName', "\t"); //tab character
They clear the value from the field, but they do not enter the white space into the field.
Update: I found that if you are using Selenium IDE, you can type white space by using their ${space} variable but this does not work when using Selenium RC and the PHPUnit Selenium extension.
recently I am having the same problem just like Andrew where the ${space} isn't work in Selenium RC. I found out that Zugwalt's solution is useful. Here is what I did to capture the whitespace.
selenium.focus("txt_textbox1");
selenium.keyPressNative("32");
strOutput = selenium.getEval("this.browserbot.findElement('txt_textbox1').value = ' ';");
Hope this help ;)
THanks #!
I fixed this in the phpunit-selenium code on github and made a pull request to the maintainer.
Here is my gist if anyone cares:
https://github.com/undernewmanagement/phpunit-selenium/commit/1b783ba8cfe4736f525b316a75a991e0a701afd1
You could use javascript injection and manipulate the value directly
selenium.getEval("this.browserbot.findElement('FirstName').value = ' ';");
Note this will not fire off any events so you would have to manually trigger them if desired.
How about setting it's value to an empty string ('')?
How about using the keyPress() function to "press" the spacebar?
You can try selenium.typeKeys('FirstName'," ");
Please let me know if it worked.
This should work for phpunit with Selenium:
class MyTest extends PHPUnit_Extensions_Selenium2TestCase
{
public function testSomething()
{
$textField = $this->byCssSelector('.blah');
// ...
$textField->clear();
$textField->value(" ");
// test assertion to follow
}
}
If you want to enter a sentence, the following won't work:
$textField->value("this is a sentence.");
The following will:
$textField->value("this");
$textField->value(" ");
$textField->value("is");
$textField->value(" ");
$textField->value("a");
$textField->value(" ");
$textField->value("sentence.");