05-14-2011, 04:05 AM
I have an array I require to display its content into QM Grid for that purpose I require you to tell how can I convert 2D array to lpstr.
changing 2D arrays to lpstr
|
05-14-2011, 04:05 AM
I have an array I require to display its content into QM Grid for that purpose I require you to tell how can I convert 2D array to lpstr.
05-14-2011, 09:13 AM
Macro Macro1534
;create 2D array for testing
05-16-2011, 07:09 AM
Thanks that's perfect.
One more problem I am using Qm Grid in my program, I want to allow the user to cells value but same time he should not be able to add/remove rows. I have switched on style for not allowing to add/remove rows. But still whenever I press Enter key it automatically inserts new row.
05-16-2011, 07:17 AM
Should not insert new row. Try this function, it does not add new row on Enter.
Function Dialog95 \Dialog_Editor
05-16-2011, 07:50 AM
True your code doesnot add rows on enter. I am providing my code please check and reply.
\Dialog_Editor function# hDlg message wParam lParam if(hDlg) goto messages #compile "qmgrid" if(!ShowDialog("Confirm_Orders" &Confirm_Orders 0)) ret BEGIN DIALOG 0 "" 0x90C80AC8 0x100 0 0 265 191 "Confirm Orders" 3 QM_Grid 0x56031041 0x0 0 0 264 162 "0x3,0,0,0,0x0[]" 4 Button 0x54032000 0x0 30 170 48 14 "Submit" 5 Button 0x54032000 0x0 192 170 48 14 "Cancel" END DIALOG DIALOG EDITOR: "" 0x2030208 "" "" "" ret ;messages sel message ,case WM_INITDIALOG ,int g=id(3 hDlg) ,;use first column as noneditable ,SendMessage g LVM_QG_SETSTYLE QG_NOEDITFIRSTCOLUMN -1 ,;add columns ,LvAddCol g 0 "Scrip" 80 ,LvAddCol g 1 "Quantity" 70 ,LvAddCol g 2 "Sell Rate" 70 ,LvAddCol g 3 "Stop Loss" 70 ,LvAddCol g 4 "Trigger" 70 ,;populate ICsv variable ,ICsv c=CreateCsv(1) ,ARRAY(str) orders ,orders.create(2 3) ,orders[0 1]="Hi" ,orders[0 2]="Hello" ,int i nc(orders.len(1)) ,for(i 0 orders.len) ,,c.AddRowSA(i nc &orders[0 i]) ,,out orders[0 i] ,c.ToQmGrid(g) ,out "ncols=%i, nrows=%i" c.ColumnCount c.RowCount , ,case WM_DESTROY ,case WM_COMMAND goto messages2 ,case WM_NOTIFY goto messages3 ret ;messages2 sel wParam ,case IDOK ,;get and show all cells ,c=CreateCsv; c.Separator="," ,c.FromQmGrid(id(3 hDlg)) ,str s ,c.ToString(s) ,mes s , ,case IDCANCEL ret 1 ;messages3 NMHDR* nh=+lParam if(nh.idFrom=3) ret DT_Ret(hDlg gridNotify(nh))
05-16-2011, 07:57 AM
I did not try, but probably need to remove
SendMessage g LVM_QG_SETSTYLE QG_NOEDITFIRSTCOLUMN -1 In QM 2.3.2 all your code can be simplified, like in my previous post.
05-16-2011, 08:53 AM
Thanks it's fine now. I will be grateful if you can suggest changes for my code.
05-16-2011, 09:05 AM
1. Easier to add columns in dialog editor, unless you need to do it at run time.
2. ICsv variable not necessary. Function Confirm_Orders \Dialog_Editor
05-16-2011, 09:24 AM
One more problem grid display extra rows than data uploaded. How can I remove those extra lines. Also how can I control number of rows and columns through code.
05-16-2011, 09:29 AM
Extra rows cannot be removed. They are read-only.
You can use functions, like g.RowAddSetSA. Type g., doubleclick a function from the list, press F1 for help. |
« Next Oldest | Next Newest »
|