VirtualTreeView: Edit next column - delphi

How can I configure a virtual tree view to edit the next column when user presses TAB?
+--------+-----------+
+ |1 + |2 +
+--------+-----------+
+ + +
+--------+-----------+
Default behaviour is editing the next node/row:
+--------+-----------+
+ |1 + +
+--------+-----------+
+ |2 + +
+--------+-----------+

I would suggest setting up the 'OnKeyPress' event and then manually directing the selected item in the treeview to the desired next item.

Related

Multiplying character-separated numbers in a cell with another cell (Distributive Property)

I have numbers in one cell that are separated by "-" and I want to multiply them by another number in another cell.
Example:
A: 12 - 6 - 8
B: 83
Doing MULTIPLY(SUM(SPLIT(A,"-")),B) is not mathematically correct. How can I do 12 * 83 + 8 * 83 + 8 * 83?
Thanks a lot.
Here's what you can try:
=INDEX(LAMBDA(ζ,JOIN("-",ζ*SEQUENCE(1,COLUMNS(ζ))))(SPLIT(A1,"-")))
Update
=PRODUCT(SPLIT(A1,"-"))
Update 2
Let's say you have 83 in B1 and 12 - 6 - 8 in A1. Here's what you can try:
=LAMBDA(ζ,SUMPRODUCT(ζ,IF(ζ,B1)))(SPLIT(A1,"-"))

receive 10002 error from paypal doDirectPaymentMethod

i send a request http://api-3t.paypal.com/nvp/ but i receive the 10002 error and my api signature and username and password is true
the invoice number is 10 digit number that is created in random C#.
my code is :
string strNVP = "METHOD=DoDirectPayment" +
"&VERSION=" + ApiVersion +
"&PWD=" + ApiPassword +
"&USER=" + ApiUsername +
"&SIGNATURE=" + ApiSignature +
"&PAYMENTACTION=Sale" +
"&IPADDRESS=151.243.189.92" +
"&RETURNFMFDETAILS=0" +
"&CREDITCARDTYPE=" + creditCard.type +
"&ACCT=" + creditCard.number +
"&EXPDATE=" + expirationMonth + "20" + expirationYear +
"&CVV2=" + creditCard.cvv2 +
"&STARTDATE=" +
"&ISSUENUMBER=" +
"&EMAIL=MatinF#outlook.com" +
//the following represents the billing details
"&FIRSTNAME=" + billingFirstName +
"&LASTNAME=" + billingLastName +
"&STREET=" + billingAddress1 +
"&STREET2=" + "" +
"&CITY=" + Address[8].ToString() +
"&STATE=" + stateName +
"&COUNTRYCODE=SW" +
"&ZIP=" + Address[5].ToString() +
"&AMT=" + TotalPrice +//orderdetails.GrandTotal.ToString("0.0")+
"&CURRENCYCODE=SEK" +
"&DESC=Test Sale Tickets" +
"&INVNUM=" + InvoiceNumber;
this appears to be a limit issue based on the recipient, version 122 for doDirect APIs update.
(10002) You've exceeded the receiving limit. This transaction can't be completed
Click here for more info

UITableView crashes because "Attempt to create two animations for cell" (iOS 7)

In an UITableView I am trying to exchange the position of two sections and to add a new row into one of them by using a batch update.
BEFORE:
+-------------------------------------+
| |
| |
| SECTION A - HEADER - TITLE |
|-------------------------------------|
| SECTION A - ROW X |
|-------------------------------------|
| SECTION A - ROW Y > |
|-------------------------------------|
| |
| |
|-------------------------------------|
| SECTION B - ROW X |
|-------------------------------------|
| |
| |
+-------------------------------------+
AFTER:
+-------------------------------------+
| |
| |
|-------------------------------------|
| SECTION B - ROW X |
|-------------------------------------|
| |
| |
| SECTION A - HEADER - TITLE |
|-------------------------------------|
| SECTION A - ROW X |
|-------------------------------------|
| SECTION A - ROW Z - NEW ROW | <---------
|-------------------------------------|
| SECTION A - ROW Y > |
|-------------------------------------|
| |
| |
+-------------------------------------+
Here is my code:
[self.tableView beginUpdates];
[self.tableView moveSection:from toSection:to]; // from: 0, to: 1
[self.tableView insertRowsAtIndexPaths:#[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; // indexPath.section: 1, indexPath.row: 1
[self.tableView endUpdates];
But the UITableView instance crashes and outputs the following:
2014-06-29 19:45:07.486 YouTube[3312:60b] *** Assertion failure in -[_UITableViewUpdateSupport _setupAnimationsForNewlyInsertedCells], /SourceCache/UIKit_Sim/UIKit-2935.137/UITableViewSupport.m:1173
2014-06-29 19:45:07.488 YouTube[3312:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempt to create two animations for cell'
*** First throw call stack:
(
0 CoreFoundation 0x0000000102447495 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001021a699e objc_exception_throw + 43
2 CoreFoundation 0x000000010244731a +[NSException raise:format:arguments:] + 106
3 Foundation 0x0000000101d42f19 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
4 UIKit 0x000000010101166c -[_UITableViewUpdateSupport(Private) _setupAnimationsForNewlyInsertedCells] + 7491
5 UIKit 0x000000010101aa81 -[_UITableViewUpdateSupport _setupAnimations] + 193
6 UIKit 0x0000000100e10615 -[UITableView _updateWithItems:updateSupport:] + 1639
7 UIKit 0x0000000100e0c000 -[UITableView _endCellAnimationsWithContext:] + 11615
...
Is it not possible to move a section and add a new row at the same time in a batch update?
I know this is an old question, but just ran into this myself on iOS 11.3. We have code that diffs old and new models and generates UITableView updates, and it explodes with the "more than one animation for cell" exception when a section is both moved and has any changes to its cells (insert/delete/update).
The only solution is to delete/insert the section in this case, rather than move. You could either always do this (and probably animate sub-optimally), or do what we do and track when cells change and do the move only when safe.
You should change dataSources as well.
- (void)exchangeTableSection
{
[self.tableView beginUpdates];
NSMutableArray *temp = self.data1;
self.data1 = self.data2;
self.data2 = temp;
[self.data1 insertObject:#"ROW Z - NEW ROW " atIndex:1];
[self.tableView moveSection:0 toSection:1];
[self.tableView insertRowsAtIndexPaths:#[[NSIndexPath indexPathForRow:1 inSection:0]] withRowAnimation:UITableViewRowAnimationAutomatic];
[self.tableView endUpdates];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (0 == section) {
return self.data1.count;
} else if (1 == section) {
return self.data2.count;
}
return 0;
}

iOS: Resizing and positioning a new view added to app started in landscape

I think this has probably been asked, but after reading a lot, I'm not sure I have found an answer.
When the app is rotated to landscape, I'm adding a new view to the main view. The new view is constructed and added in code like this:
UIView * newView = ....
[rootView addSubview:newView];
But because the simulator is rotated to landscape when I add the new view I get this:
+------------------------------------------------------+
+ +---------------------------------------------+ +
+ | | | +
+ | | | +
+ | newView | rootView | +
+ | (Landscape | (Landscape) | +
+ | but portrait size) | | () +
+ | | | +
+ | | | +
+ | | | +
+ | | | +
+ +---------------------------------------------+ +
+------------------------------------------------------+
So I added newView.bounds = rootView.bounds; newView.center = rootView.center; thinking that would position the newView directly over the top of the rootView, but instead I got this:
+------------------------------------------------------+
+ +---------------------------------------------+ +
+ | | +
+ | | +
+ |--------------------------+ rootView | +
+ | | (Landscape) | +
+ | newView | | () +
+ | (Landscape size, | | +
+ | but offset) | | +
+ | | | +
+ | | | +
+ +---------------------------------------------+ +
+------------------------------------------------------+
I'm trying to figure out why they are different even though I've set the bounds and centers to be the same.
Dumping out the views I get this:
rootView; frame = (0 0; 768 1024); transform = [0, -1, 1, 0, 0, 0]; autoresize = W+H; layer = <CALayer: 0x98870a0>>
newView ; frame = (-128 128; 1024 768); autoresize = W+H; layer = <CALayer: 0x6e470a0>>
So it appears that the rootView is still 768w x 1024h, just rotated by a transform, and after setting bounds and centre, the new view is 1024w x 768h and offset by 128 points.
After some more playing around, I came up with this:
// Position the new view offscreen.
CGFloat width = rootView.bounds.size.width;
CGFloat height = rootView.bounds.size.height;
newView.frame = CGRectMake(0, height, width, height);
[rootView addSubview:newView];
// Animate to the center of the view.
[UIView animateWithDuration:1.0 animations:^{
newView.frame = CGRectMake(0,0, width, height);
}];
It works, I'm just wondering if there is a better solution.

Entity framework joins

I'm using the entity framework 4.0 and I'm having some issues with the syntax of my query. I'm trying to join 2 tables and pass a parameter to find the value at the same time.I would like find all of the products in table 2 by finding the correlating value in table 1.
Can someone help me out with syntax please?
Thanks in advance.
sample data
table 1
ID productID categoryID
361 571 16
362 572 17
363 573 16
364 574 19
365 575 26
table 2
productID productCode
571 sku
572 sku
573 sku
574 sku
575 sku
var q = from i in context.table1
from it in context.table2
join <not sure>
where i.categoryID == it.categoryID and < parameter >
select e).Skip(value).Take(value));
foreach (var g in q)
{
Response.Write(g.productID);
}
var q = from i in context.table1
join it in context.table2 on i.productID equals it.productID
where i.categoryID == it.categoryID and it.productCode = xyz
select i).Skip(value).Take(value));

Resources