Wide Studio Object Reference

Wide Studio Home
Up to


Class Name

WSCpopupMenu

Specification of methods



registerClient method

Form
long registerClient(WSCbase* client)
Function
Registers the instance to display the popup menu.
Description
It makes a popup menu appear when the specified instance is clicked by a mouse pointer.
Parameters
(in)WSCbase* client the GUI instance
Return value
None.
Notice
Do not register twice or more. You must cancel the registration of the instance by the unregisterClient() method, if you destroy it.
Samples
An example of the initialize event procedure.
#include 
void menu1_proc(WSCbase* client){
  //executes by Menu 1 
}
void menu2_proc(WSCbase* client){
  //executes by Menu 2
}
void menu3_proc(WSCbase* client){
  //executes by Menu 3
}
void init_event_proc(WSCbase* client){
  //Creates an instance of the popup menu.
  WSCpopupMenu*  pmenu = new WSCpopupMenu(NULL,"menu");
  pmenu->initialize();
  //Sets up properties of the menu.
  pmenu->setPropertyV(WSNmenuItemHeight,(WSCushort)20);
  pmenu->setPropertyV(WSNshadowThickness,(WSCuchar)1);
  pmenu->setPropertyV(WSNbackColor,"gray85");
  pmenu->setPropertyV(WSNtopShadowColor,"gray95");
  pmenu->setPropertyV(WSNbottomShadowColor,"gray55");
  //Sets up the menu elements.
  pmenu->setPropertyV(WSNmenuItems,
       "Menu 1:menu1,Menu 2:menu2,Menu 3:menu3");

  WSCprocedure* 
  pmop = new WSCprocedure("menu1",WSEV_NONE);
  pmop->setFunction(menu1_proc,"_menu1_proc");
  pmenu->addProcedure(pmop);

  pmop = new WSCprocedure("menu2",WSEV_NONE);
  pmop->setFunction(menu2_proc,"menu2_proc");
  pmenu->addProcedure(pmop);

  pmop = new WSCprocedure("menu3",WSEV_NONE);
  pmop->setFunction(menu3_work,"menu3_proc");
  pmenu->addProcedure(pmop);

  pmenu->registerClient(client);
}



unregisterClient method

Form
long unregisterClient(WSCbase*)
Function
Cancels registration of the specified instance.
Description
Removes the specified instance from the list of registered instances.
Parameters
(in)WSCbase* client the registered instance
Return value
None.
Notice
None.
Samples
Refer to registerClient().



onActivate method

Form
void onActivate()
Function
It executes this method when the menu item is selected.
Description
Instead of the event procedure by the WSEV_ACTIVATE trigger, the WSEV_ACTIVATE event can be handled by overloading of this method.
Parameters
None.
Return value
None.
Notice
If needed, overload this method on the sub classes.
Samples
void new_class::onActivate(){
  //do something when the menu item is selected.

  //call the method of the parent class.
  old_class::onActivate();
}


Document Release 3.20

For use with Wide Studio Release 3.20, Spring 2003


Wide Studio Home | Up to

Copyright(C) T. Hirabayashi, 1999-2003 Last modified: February 3, 2003