|
Here's a quick function from Martin Kusl that allows you to set a plus or a minus sign for a particular item in a TreeView:
void SetPlus(WTreeViewItemHandle item,WBool sign)
{
TV_ITEM tvi;
tvi.mask=TVIF_CHILDREN;
tvi.hItem=(HTREEITEM)item;
Tree->SendMessage(WMessage(TVM_GETITEM,0,
(WLong)&tvi));
tvi.cChildren=sign;
Tree->SendMessage(WMessage(TVM_SETITEM,0,
(WLong)&tvi));
}
Stew Stryker writes us:
Power++ has a ScrollToRow(), but if you're manually controlling how people move between columns and do a SetColumn(), how do you get the screen to scroll along with it? I've seen a one-page PowerBuilder routine that would handle it, but had trouble implementing in Power++.
But the answer is that ScrollToRow() will automatically scroll to the correct column after a SetColumn().
Author: Steffen Uhlig
I tried to define my own templated classes within Power++. As long as all code is within a header file (*.hpp) or the header part of a managed class (*.wxc) there is no difference to writing plain classes.
Then I moved parts of the code definition to the implementation part (*.cpp). The compilation was fine but linking failed with the linker error 1028: "%S is an undefined reference"
After reading the manual I found a hint at
...
Placing class templates
You can list the declaration of the class templates in a header file and define its member functions in a CPP file. However, since the compiler does not compile template code, you must include the CPP file (instead of the header file) in the source code of CPP files that use the class template. An alternative to this approach is to declare and define the class template in a header file and then include the header file in the source code of CPP files that use the class template.
...
Resume: The trick is to include the CPP file instead of the header file into the class where you use your new templated class. The CPP file in turn includes the header file. Therefore the header is visible automatically to the class where you use the templated class.
Steps to create a template class
To demonstrate the creation of a templated class we'll define a container class which holds a single element of the arbitrary type T."ContainerT"
.
template <class T>
just before the first read-only line (where the class declaration
specification gets defined).
_element
within the class declarations as type T
. When you later instantiate the class ContainerT for, say, an
integer, you would write
ContainerT<int> _myIntCont; // a container which holds a single integer
"ContainerT"
to "ContainerT<T>"
and add the line template <class T>
before the function / method / property definition.
ContainerT
you must include the CPP file instead of the usual HPP file:
After successfully creating the templated class I wanted to create
another class which inherits from my brand new ContainerT
class. But the Power++ IDE does not let me specify templates
as base classes:
IntContainer
. We only have to define the alias in the header section of the
class which inherits from the templated class:
typedef ContainerT<int> IntContainer;
So, for my example of a class which inherits from WListBox and
from ContainerT