Can't get CurrentSelection, or CurSel, to work:
(dcl_Project_Load "D:/opendcl/frames" T)
(dcl-Control-SetCaption frames/Form1/Proceed "ggg")
(dcl-Control-SetCurrentSelection frames/Form1/MAIN-OptionList1 2)
(dcl-Control-GetCurrentSelection frames/Form1/MAIN-OptionList1)
(dcl-Control-SetWidth frames/Form1 330)
(dcl_Form_Show frames/Form1)
Lines 1, 5 and 6 work fine, but 2-4 don't. Am I missing something? The OptionList has the DblClicked and SelChanged events checked.
Hi, I'm irritated: did you really write these lines in one go? Then it won't work.
Please have a look at the concept of events. It's not like native DCL!
You will find an example here (http://www.opendcl.com/forum/index.php?topic=1080.0).
Regards, Fred
Fred, thanks for the speedy, if irritated, reply.
I'm not sure where I'm to look in your example. I have separate c: functions for all the events (#OnClicked, #OnSelChanged, #OnDblClicked) but I thought that I would set form data between the (dcl_Project_Load and (dcl_Form_Show - as lines 1,5,6 work fine. How can I set the second item of an OptionList to be current? (The CurrentSelection is not always going to be 2, it will be variable.)
S
Ok, so everything between Load and Show should be in an OnInitialize, with the Event checked for the Form.
(defun c:frames/Form1#OnInitialize (/)
(dcl-Control-SetCurrentSelection frames/Form1/MAIN-OptionList1 (atoi *FRAMES_sizeA*))
(dcl-Control-SetCurrentSelection frames/Form1/MAIN-OptionList2 (atoi *FRAMES_sheetlength*))
(dcl-Control-SetCurrentSelection frames/Form1/MAIN-OptionList3 (atoi *FRAMES_viewport*))
(dcl-Control-SetCurrentSelection frames/Form1/MAIN-OptionList4 (atoi *FRAMES_titleblock*))
(dcl-Control-SetWidth frames/Form1 330)
)
(dcl_Project_Load "D:/opendcl/frames" T)
(dcl_Form_Show frames/Form1)
A slow learning curve for me.
Thanks for the (vague) pointer.
S
Hi, I recommend you to start with the tutorial and the sample files coming with OpenDCL installation.
Regards, Fred