On Fri, Jul 6, 2012 at 12:51 PM, Roger Bilau <s...@bilau.de> wrote: > due to your response and the sample which Håkan (thanks a lot for this) has > sent to me, > I have the impression that my idea to call the new code from the existing > code does > not work. Is it so?
No it can work. > > I insert my current test source below. As you see, first I read the DB2 data > into the > stem column. and count the number of result rows in the variable CC - then > I try to read column. and CC in the ::method initDialog - is this not > possible? Yes, it's possible. It's basically what I meant by: > The other approach would be to assemble your data first using your DB2 > routines and pass it into the dialog. There are a number of different ways to do it. As Håkan suggests it is similar to what he does in his example program. One way to do it is as follows. Hopefully this will be easy to understand. When you write a subclass, you can add methods to fit your particular needs. Since you first said you were altering the columnClickListView.rex example, I'll just stick with that. The basic idea is to add a method to the dialog class where you pass in the data to the dialog. ::class 'SimpleLV' subclass UserDialog ::method setDB2data expose Column. CC use arg data., count Column. = data. CC = count 0The new method is as above. You set the exposed variables Column. and CC to the values you passed in. Then when you instantiate the dialog object, you pass in your data *before* you execute the dialog. ShowColumnList: trace ?I dlg = .SelectColumn~new if dlg~initCode = 0 then do -- Add a symbolic resource ID for the list view. dlg~constDir[IDC_LISTVIEW] = 200 dlg~create(30, 30, 225, 200, "Selektieren Sie bitte die gewünschten Columns", "VISIBLE") dlg~setDB2data(Column., CC) dlg~execute("SHOWTOP") end Return 0 Now, when you are not familiar with ooDialog, it is a little hard to picture, but, the initDialog() method does not run until after you invoke execute(). So in the above, the setDB2data() method will have run and returned before initDialog() runs. When initDialog() does run, the Column. and CC variables will have been set. You change your initDialog() method to expose the same two variables as are in the setDB2data(): ::method initDialog expose Column. CC -- Get a reference to the list view. list = self~newListView(IDC_LISTVIEW) list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP") list~insertColumn(0, "Select", 25) list~insertColumn(1, "Column Name", 120) do i = 1 to CC list~addRow(i, , , Column.i.2, Column.i.3) end And the above will work. To help yourself see it working add a say statement to both methods and run your program from a command prompt so that you will see the say output: ::method setDB2data expose column. CC use arg data., count column. = data. CC = count say 'In setDB2data()' say 'Arg count is:' count 'the CC exposed variable now is:' CC ::method initDialog expose Column. CC say 'In initDialog(), the value of CC is:' CC -- Get a reference to the list view. list = self~newListView(IDC_LISTVIEW) list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP") list~insertColumn(0, "Select", 25) list~insertColumn(1, "Column Name", 120) do i = 1 to CC list~addRow(i, , , Column.i.2, Column.i.3) end Since you are new to objects and methods, I think the above approach is relatively easy to understand. Håkan's approach in his program is the same idea, but using attributes. Which, once you get familiar with objects and methods a little, is probably the approach you will take. Just keep asking questions until you get things working. -- Mark Miesfeld ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Oorexx-users mailing list Oorexx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-users