How to implement excel-like formula editor in XtraGrid? - devexpress

I'm working on complicated system, which allows some values in grid to be calculated by formulas.
Right now I have textbox control above grid.
It works in this way:
When you start editing inside in-place editor and first symbol is '=' - focus is moved to that textbox control above.
At this moment grid is made readonly, and when user clicks on grid cells - coordinates of the clicked cell are passed to formula editor, so it can add links to formula. When you press Enter or Esc in text editor - formula is being written to underlying dataset and grid is made editable back.
The goal:
I want this too look more like Excel grid. Don't like focus to jump somewhere outside.
Is it possible to keep editor open and at the same time allow user to click anywhere on grid? So, all formula editing will be performed inside inplace editor?
Right now, there's no event to disallow closing editor. If I use 'ValidateEditor' event - it doesn't even allow to use scrollbars.
Is there a way to keep editor open and leave navigation working?

Seems I have found way round that myself.
I handle ValidatingEditorEvent, and if edit value starts with '=' I set boolean flag in my control. Also, I remember text before and after cursor position, and cell coordinates (FocusedRowHandle, FocusedColumn).
When I receive Click event, I get clicked cell coordinates and if boolean flag is set - I focus previous cell, activate editor and add what I need to inpalce editor.
Seems to work fine.

Related

select2 - Loading remote data - always show search field but expand with results/noResults on focus

is it possible in Select2 to while using Loading remote data to have the search input always visible and not expanded only when clicked on the select?
The next thing would be to hide the search results (or no results, or please enter n or more character message) until the user has clicked inside the input.
And the last thing would be to put some placeholder text inside the search field.
I've been playing around with it for some time but can't figure it out.

Text in flash button symbols all change at once (Actionscript 2)

I have reached an impass which means I have to spend many hours doing something in a very tedious way because I can't work out a way to do it quickly, here is my problem.
In flash if I make a button that consists of a rectangle and a text field then make it all a button symbol, if I then copy the symbol to multiple instances on screen and change the text in one of them, it changes in all of them because I am changing the symbol.
How can I overcome this, perhaps with actionscript? I tried writing.
button1.text1.text = "test change button text"; on the main canvas (and giving one button a name of button one and the text field within it text1) but it doesn't work.
The only thing I found that works was to make multiple symbol copies of the button but then if I want to change the colour or dimensions of all the buttons it takes ages.
Is there a better way? Using actionscript 2 perhaps, or just some property of the button to allow individual text?
I attempted your situation... and I didn't run into your problem. Text boxes are individual values, provided that the text box is dynamic or input
I think that what may solve your problem is checking what kind of text boxes you are working with. Look in the properties panel; does it say "dynamic"?

Powerbuilder Excel-Cell like edit functionality on Datawindow Grid

I've been given a very unusual request of emulating excel-like editing functionality for my grid.
Here's the scenario: The users would like to be able to immediately change the content by clicking on the cell and typing whatever they wish. Currently, they have to double click on the cell to block select the content, and then type in their desired text to overwrite the cell contents. They'd like the intermediate step of double clicking to block select the text to be taken out. The editable cells hold only numbers.
So I have two options:
1. Automatically block select the cell contents as soon as the user clicks on it
2. Make the cell selection/edit behave the same way as excel
Given Powerbuilder's inherent limitations, I'm fairly convinced this is impossible without some wacky hack, but I'd like to hear ideas.
PowerBuilder does handle this with ease but you can look like a hero to your end-user now.
:)
Auto Select Text in Datawindow Edit Fields
In your datawindow painter, choose the column, then check the "auto select text" property. This will cause your text to be selected as soon as the field gets focus. Now the problem is that PB doesn't provide this feature for edit mask controls but you can get around that yourself using the below example.
Auto Select Text in Edit Mast controls in Datawindow
Add code to your datawindow control that checks for an edit mask field and highlights the text. The example could be put into the itemfocuschanged event of the datawindow control, or in your datawindow control ancestor.
// only if row present
if row > 0 then
if describe( dwo.Name + '.Edit.Style' ) = 'editmask' then
// we found an edit mask so select the text in it
this.selecttext(1,len(string(getitemstring(row,dwo.Name))))
end if
end if
Did you try the Auto Selection edit property?

Users are Mad! Wijmo Grid AfterCellUpdate not triggering

I have a editable wijmo grid that works pretty good but there is a problem that continues to stump me and makes users upset.
When you double click to edit a cell, after it's been edited, the AfterCellUpdate (AfterCellEdit or any other) event is never triggered if you click anywhere on the page that is outside of the actual grid; events do fire if you click inside the grid.
This has proved to be rather inconvenient since I need to process the underlying data every time cell data is changed and it is common for a user to double click, edit the data, and then click the save button without clicking inside the grid (and it makes sense to me that they should be able to do that).
Of course, the data doesn't get saved because it doesn't appear to have been changed in the data source; this doesn't make them happy :-)
It does save the data properly if they click in the grid and then click save.
Can someone PLEASE shed some light into this rather perplexing issue???
BTW, I saw similar behavior in some of the sample code that comes with the product; I mean when editing if I clicked outside the grid it stays in edit mode on the cell being edited.
Wijmo grid saves the data when the current cell changes. To save data on clicking the save button without having to click inside the grid, you could call the endEdit method of the grid on the save button click.
$("#btnSave").click(function(){
$("#grid").wijgrid("endEdit");
});

Looking for a vb.net code to add existing buttons/text boxes/drop down lists, etc. to a container, or holder?

I'm using vb.net. Basically, I have a drop down list, text box and a submit button. You choose a movie director from a drop down list, then type in a movie, click button and it adds the data to my database.
There's another button which hides/shows drop down list, text box and submit button using Visible = True and Visible = False, but what I don't like about it is when it hides the things I said before, it leaves some white/empty space like if they are still there, but not visible.
Is there anyway to put some kind of holder/container and place a button which when clicked could add my drop down list, text box and submit buttons to that place?
Cheers,
E.N.
I assume that you are working with WinForms in Visual Studio. In the Toolbox the controls which could help you out of this situation are in the "Containers" section. Among others, there is a Panel, a FlowLayoutPanel and a TableLayoutPanel (see this video on msdn for a TableLayoutPanel Demo). They can help you to organize controls. Especially the FlowLayoutPanel places the controls automatically. But you can always change the Top and the Left properties of any control, to move them around to the desired place or group some of them on a Panel and change the Location of this one one.
You can add a control to a container by using the Add method of its Controls property. However, if the control is already on the form (since you are asking how to add an existing control) you must remove it from the form before.
Me.Controls.Remove(myButton)
panel1.Controls.Add(myButton)

Resources