C# - Second Application

[Top]  [Chapter]  [Previous]  [Next]

Our second application developed in C# should test all available wpa action names.

 

We need a form with 3 elements:

 

clip0044

 

Now we add an event handler for the VisibleChanged event of the form. In this event handler we first select the editor mode for the editor and load the layout (PCC file).

 

Then  we initialize the listbox by adding the names and captions of all available wpaActions.

  using WPDynamic;        

 

        private void WinForm_VisibleChanged(object sender, System.EventArgs e)

         {

                  // Select Editor Mode !

                   WPDLLInt1.SetEditorMode(

                   EditorMode.wpmodSingleEditor,

                   EditorXMode.wpmodexToolbarLG,

                  // EditorGUI.wpguiGutter +

                   EditorGUI.wpguiHorzScrollBar |

                   EditorGUI.wpguiPanelH1|

                  // EditorGUI.pguiPanelH2 |

                   EditorGUI.wpguiPanelV1|

                   EditorGUI.wpguiPanelV2 |

                   EditorGUI.wpguiRuler  |

                   EditorGUI.wpguiVertRuler  |

                   EditorGUI.wpguiVertScrollBar

                   , EditorGUI.wpguiDontSet );

 

                  // Load buttons and change language (if required)

                   WPDLLInt1.SetLayout("buttons.pcc","");

                  // WPDLLInt1.SetLanguage("DE");

 

                  // This would be NOT allowed before WPDLLInt1.SetEditorMode !

                   WPDLLInt1.Memo.TextCursor.InputText("Hello World");

 

                  // Init Listbox

                   string n = "",c ="",h ="";

                  for(int i=0; i<1000;i++)

                   {

                          if (!WPDLLInt1.Memo.wpaGetCaption(i,ref n, ref c, ref h)) break;

                          listBox1.Items.Add(n+"="+c);

                   }

         }

 

Now we only need one line of code to be attached to the button:

 

         private void button1_Click(object sender, System.EventArgs e)

         {

            WPDLLInt1.Memo.wpaExec(listBox1.SelectedIndex, "");

         }

 

Now you can start the application, select one of the action entries and click on the execute button.

 

(Note: Some of the actions are not used at present time, some can be only used when used by drop down combos in the toolbar. Please see the WPA-Name List.)

 

 

 

 


[secondcapplication.htm]    Copyright © 2007 by WPCubed GmbH