11.6
I would like to understand a bit more of classes. Could anyone explain the following:
Normally I would do it like this when I add a button to a Telerik grid, like static, but now I want to do this more dynamic:
So how do I create the anchorstyle and the button in a dynamic way, like create button..... ? Can I make a static class, and store the result in a temp-table ? Or should I do it with a extent parameter? I am strugling understand this conspet :-)
**************************************
DEFINE PRIVATE VARIABLE button1 AS System.Windows.Forms.Button NO-UNDO.
DEFINE VARIABLE nestedvar1 AS System.Windows.Forms.AnchorStyles NO-UNDO.
nestedvar1 = CAST(Progress.Util.EnumHelper:Or(CAST(Progress.Util.EnumHelper:Or(System.Windows.Forms.AnchorStyles:Top, System.Windows.Forms.AnchorStyles:Bottom), System.Windows.Forms.AnchorStyles), System.Windows.Forms.AnchorStyles:Left), System.Windows.Forms.AnchorStyles).
THIS-OBJECT:button1:Anchor = CAST(Progress.Util.EnumHelper:Or(nestedvar1, System.Windows.Forms.AnchorStyles:Right), System.Windows.Forms.AnchorStyles).
THIS-OBJECT:button1:FlatStyle = System.Windows.Forms.FlatStyle:Flat.
THIS-OBJECT:button1:Image = CAST(resources:GetObject("button1.Image"), System.Drawing.Image).
THIS-OBJECT:button1:ImageAlign = System.Drawing.ContentAlignment:TopLeft.
THIS-OBJECT:button1:Location = NEW System.Drawing.Point(195, 3).
THIS-OBJECT:button1:Name = "button1".
THIS-OBJECT:button1:Size = NEW System.Drawing.Size(186, 54).
THIS-OBJECT:button1:TabIndex = 0.
THIS-OBJECT:button1:Text = "button1".
THIS-OBJECT:button1:UseCompatibleTextRendering = TRUE.
THIS-OBJECT:button1:UseVisualStyleBackColor = TRUE.
THIS-OBJECT:button1:Click:Subscribe(THIS-OBJECT:button1_Click).
But I would like to build i.e. n number of buttons, with 1 event that checks i.e. the name of the button to do a special thing. The thing I kind of not sure of, is what to do with the classes that will be overwritten for each button.
I have been thinking making a variable button as class ..... extent. Then find what number of buttons that will be created, and with that do a extent(...) = number of buttons. Then I will be able to store all buttonclass...
Is that a good way of doing it?
Thanks Brian, ok, so I really don't need to store the class... nice to know.