How to set selecting full row with CGridCtrl in MFC? - mfc

How to set selecting full row in CGridCtrl?
I already set setting in my code. What setting should be helpful for me?
grid.EnableTitleTips(FALSE);
grid.SetEditable(TRUE);
grid.SetVirtualMode(bVirtualMode);
grid.SetListMode(TRUE);
grid.EnableDragAndDrop(FALSE);
grid.EnableSelection(FALSE);
grid.SetFixedRowSelection(FALSE);
grid.SetFixedColumnSelection(TRUE);
grid.SetFrameFocusCell(TRUE);
grid.SetTrackFocusCell(FALSE);
grid.SetRowResize(FALSE);
grid.SetColumnResize(TRUE);
//grid.SetHeaderSort(TRUE);
//grid.ExpandToFit(TRUE);
grid.SetGridBkColor(COLOR_GRIDBACK);
grid.SetBkColor(COLOR_GRIDBACK);
grid.SetTextBkColor(COLOR_GRIDBACK);
grid.SetFixedBkColor(GetSysColor(COLOR_BTNFACE));
//grid.SetFrameFocusCell(TRUE);
grid.SetSingleRowSelection(TRUE);
//grid.SetAutoSizeStyle();

I got an answer myself. It is influenced by each others.
grid.EnableTitleTips(FALSE);
grid.SetEditable(TRUE);
grid.SetVirtualMode(bVirtualMode);
grid.SetListMode(TRUE);
grid.EnableDragAndDrop(FALSE);
//grid.EnableSelection(FALSE);
grid.SetFixedRowSelection(TRUE);
grid.SetFixedColumnSelection(TRUE);
grid.SetFrameFocusCell(FALSE);
grid.SetTrackFocusCell(FALSE);
grid.SetRowResize(FALSE);
grid.SetColumnResize(TRUE);
//grid.SetHeaderSort(TRUE);
//grid.ExpandToFit(TRUE);

Related

Atom - Adding a keybind shortcut to insert code snippet

I'm trying to create a keybind in the Atom text editor that will insert the code:
<cfdump var="##">
and
<cfabort>
using ctrl+shift+d and ctrl+shift+a respectively, just as it is in Eclipse. The previous posts don't touch on this issue.
So far, I've tried editing the keymap.cson file with
'atom-text-editor':
'ctrl-shift-d': 'custom:insert-dump'
'atom-text-editor':
'ctrl-shift-a': 'custom:insert-abort'
and adding the below to init.coffee:
atom.commands.add 'atom-text-editor',
'custom:insert-dump': ->
atom.workspace.getActiveTextEditor()?.insertText('<cfdump var=\"\#\#\">')
atom.commands.add 'atom-text-editor',
'custom:insert-abort': ->
atom.workspace.getActiveTextEditor()?.insertText('<cfabort>')
I've managed to get the < cfabort > to work, but the cfdump just produces a newline. I'm sure I'm making some silly mistake. Any suggestions?
Thank you.
In keymap.cson, I added:
'atom-text-editor':
'alt-q': 'custom:tom'
In init.coffee, I added:
atom.commands.add 'atom-text-editor', 'custom:tom', ->
editor = atom.workspace.getActiveTextEditor()
tomstring = editor.getSelectedText()
editor.insertNewlineBelow()
editor.insertText('<cfdump var="#'+tomstring+'#" label="'+tomstring+'"><cfabort>')
editor.save()
To use in the editor hightlight what you want to dump and do alt-q.
You can fix it by changing the keymap.cson to:
'atom-text-editor':
'ctrl-shift-d': 'custom:insert-dump'
'ctrl-shift-a': 'custom:insert-abort'
and the init.coffee to:
atom.commands.add 'atom-text-editor',
'custom:insert-dump': ->
atom.workspace.getActiveTextEditor()?.insertText('<cfdump var=\"\#\#\">')
'custom:insert-abort': ->
atom.workspace.getActiveTextEditor()?.insertText('<cfabort>')

Get RowHeader Text in SpreadJs

I want to get the row header text, after clicking on any specific row. It could be number/alphabet. Yes, I'm able to get its index. But I want to get its text value, which i'm needed to show elsewhere in my case. I didn't found any idea or solution in its documentation page Get Sheet Header. Hope, there's any way to figure out this problem. Thanks for any solution/advice.
You can get the row header text by using getCell and passing in the SheetArea.rowHeader variable. Here is how to do it on a cell click (or header click):
activeSheet.bind(GcSpread.Sheets.Events.CellClick, function (sender, args) {
if (args.sheetArea === GcSpread.Sheets.SheetArea.rowHeader) {
alert("Row header text: " + activeSheet.getCell(args.row, args.col, GcSpread.Sheets.SheetArea.rowHeader).value());
}
});
Let me know if that helps.
Regards,
Kevin

Does webstorm have some shortcut for console.log or console.info?

Just tired of typing console.log again and again, and do not find a way like Sysout + Control + Space in Eclipse will create System.out.println().
There's a predefined Postfix template that allows you to type .log after a JavaScript expression or string and hit Tab to transform it to console.log().
You can also create a Live template (see Preferences | Editor | Live templates) that would expand into a code snippet once you type the selected abbreviation and hit Tab.
Update: there's now also a plugin that allows you to add console.log with a shortcut: https://plugins.jetbrains.com/plugin/10986-console-log
Yes it does,
<anything>.log and press Tab key. This will result in console.log(<anything>);
ie,
<anything>.log + Tab => console.log(<anything>);
eg1: variable
let my_var = 'Hello, World!';
my_var.log + Tab => console.log(my_var);
eg2: string
'hello'.log + Tab => console.log('hello');
eg3: string and variable
'hello', my_var.log + Tab => console.log('hello', my_var);
[UPDATE 2020]
Typing log + Enter autocompletes to console.log()
I made my own template that seems to work.
It may be useful for somebody.
Abbreviation: ll
Template text:
console.log('$NAME$ ', $VALUE$);
$END$
Variables: (just select the given field values by clicking drop down box)
NAME - jsDefineParameter()
VALUE - jsSuggestVariableName
I'm including what I find to be the most efficient, which I added via live templates -> javascript -> applicable to "Everything". Hopefully someone finds it useful.
console.log('L$LINE$ $MYSTRING$ ===', $MYVAR$);$END$
What it does:
When I type cl and press tab, it creates the log and the first thing you type fills both MYSTRING and MYVAR variables. If you tab again, it selects MYVAR where you can rewrite/delete as desired. The third time you hit tab will take you to the end of the line at $END.
This snippet also prints the line number like L123 but you can easily remove that if it isn't helpful because obviously most browsers show line number anyway.
You also have to set the variables' behaviour as seen in the image below:
Edit variables setup
use Macros!
https://www.jetbrains.com/help/webstorm/using-macros-in-the-editor.html
I recorded a macro that takes the name my cursor is on and create
console.log("#### name = ", name);
on the next line.
and assigned a keyboard shortcut to it :)
super easy, and couldn't get Live Template to get the same result with 1 action.
to create a new macro: Edit -> Macros -> Start Macro Recording. then record your next moves and create the desired result.
this is mine:
This is my solution, it somewhat mimics a turbo-console approach and gives you certain freedoms to build on it.
Step 1: Go to Editor > General > Postfix Completion;
Step 2: Click on JavaScript, click the + button, select JavaScript and TypeScript;
Step 3: In the Key input, type a alias for your command, I choose 'cl' for mine;
Step 4: In the 'Minimum language level' select your desired preference, I choose ECMAScript 6+;
Step 5: In the bellow text area, add your logic, for me it is console.log('$EXPR$', $EXPR$, '$END$');
Step 6: Customize however you like.
So what does all of this do?
Lets consider the following:
const willNeedToBeLogged = 'some value you want to check';
All you need to do for a console long is type
willNeedToBeLogged.cl + press (Tab, Enter or Spance)
And you will get this
console.log('willNeedToBeLogged', willNeedToBeLogged, '');
With your cursor being on the $END$ variable, where you could write, a line, or anything you like.
Have fun!
I made a custom template. This can help you.
Abbreviation: clog
Template code:
console.log("\n\n--------------------------------");
console.log($END$);
console.log("--------------------------------\n\n");
Simplest live template text:
console.log($END$);
Maybe it is a recent addition but you can write log and hit tab and console.log() will appear with the caret in between the braces.
The answer from Ekaterina Prigara (https://stackoverflow.com/a/32975087/5653914) was very useful to me but if you want to log a string like "Test" this method is quicker.
Try a logit plugin. It provides the next logging pattern by default:
const data = 'data';
console.log('-> data', data);
You can configure it.
Try Dot Log (vscode extension), It can automatically transfer aaa.log to console.log('aaa', aaa )

How to get a table cell in aspose slides?

I see this sample:
http://www.aspose.com/docs/display/slidesnet/Creating+a+Table+from+Scratch
...and when I try to use it, I see that the library has changed (I guess) and it needs me to do sth like that:
int lIndex = pSld.Shapes.AddTable(pUppLeftPoint.X, pUppLeftPoint.Y, pColumnWidths, pRowWidths);
TableEx lTable = (TableEx)pSld.Shapes[lIndex];
(I can only cast to TableEx and not to Table)
But I cannot find how to get the cell's TextFrame. The site says :
TextFrame tf = table.GetCell(0, 0).TextFrame;
But I have nothing like this...
Am I missing sth?
Any ideas?
EDIT :
I found out that my code is for PPTX and the site's code for PPT:
http://www.aspose.com/community/forums/thread/453613/facing-performance-issue-due-to-addtable-method-of-pptx.aspx
But, again, how do you get the cell's contents in PPTX?
Ha! I got it!
There's an indexer:
lTable[i,j]

ValueChanging event on Infragistics WebDataGrid

Does anyone have an idea why this doesn't work or a workaround?
I'm trying to use the ValueChanging event from inside an EditorProvider
I have defined an EditProvider
<ig:TextEditorProvider ID="tepPercent">
<EditorControl HorizontalAlign="Right" ClientEvents-ValueChanging="validatePercent4Decimals"></EditorControl>
</ig:TextEditorProvider>
And a javascript handler
function validatePercent4Decimals(sender, args) {
var oldfieldvalue = args.get_oldValue();
var newfieldvalue = args.get_value();
if (isNaN(newfieldvalue)) {
args.set_value(oldfieldvalue);
args.set_cancel(true);
}
}
I've debugged it and can see it is running, and if I enter 34r, the inNan tests true and the set_value and set_cancel are called. But the value on the grid does not change from the 34r...
What's going on?
From this post on the Infragistics forums I believe that you have a numeric column. If this is the case then you should use a NumbericEditorProvider instead. There are more details on the available editor provides in the Infragistics help:
http://help.infragistics.com/NetAdvantage/ASPNET/2011.1?page=WebDataGrid_Editor_Providers.html