T O P I C R E V I E W |
TreeNode |
Posted - 10/22/2010 : 12:24:51 PM Origin Ver. and Service Release: Origin 8, SR6 Operating System: Win XP
Hi,
I am using GetNBox Dialogs as User Interface. The Dialog, which is shown after calling method GetNBox(TreeNode& tr... ), is always positioned in the middle of the screen. So it overlaps my GraphPage that I want to edit with the Diaolg.
So everytime I want to use this Dialog I have to move it to the right, so it doesnt overlap my GraphPage anymore. This is very annoying in the length of time.
I wanted to use the Dialog Object which is committed by the eventhandler-function, to get the Window by GetWindow() method, and then move the window to the right position, when the Dialog is initialised. Then I noticed, that the class Dialog is only available in OriginPro.
So I wondered, if there is another possibilty to succeed?
|-- TreeNode ...|-- a?? ...|-- ha!! |
4 L A T E S T R E P L I E S (Newest First) |
Iris_Bai |
Posted - 12/19/2010 : 9:49:22 PM Hi,
The reason of GetN dialog always keep the same size is we will auto resize GetN dialog in low level codes according to the controls' size on dialog.
For example, please try: Change the label of xFrom treenode in the above testDialogGetWindow() function from the current string "X From" to "x From(this is a test.........)", open dialog again, the dialog size will be changed to auto fit the width of control.
Do auto resize dialog after GETNE_ON_INIT event, so even use Window::MoveWindow to resize dialog in dialog init event, dialog still will be resize in our internal code.
I suggest you use dialog builder to replace GetN dialog.
Please refer to here for more information about Developer Kit.
And there is a resize dialog sample under Origin install folder\Samples\DeveloperKit\Dialog Builder\ActiveXDLG, GridDLG.cpp and GridDLG.h files.
Iris Originlab
|
TreeNode |
Posted - 12/17/2010 : 11:17:01 AM Hi,
Now I have another problem relating to this issue. The positioning of the GetNBox-Dialog works. But I want to set the position in dependence of the width of the dialog. I want the upper right corner of a GetNBox-Dialog-Window always stay at the upper right corner of the main window Client-Area. Thats why dialogs with a smaller width have to move farther to the right, than broader ones.
But when calculating the width and height of the dialog, like in your example above, it always calculates the same values, although the width and height of the GetNBox-Dialogs are different:
int width = rr.right-rr.left;
int height = rr.bottom-rr.top; Can you imagine what happens?
|-- TreeNode ...|-- a?? ...|-- ha!! |
TreeNode |
Posted - 11/11/2010 : 06:48:01 AM Hi Penn,
thanks for quick reply! Your example works fine on my coputer too. You did not use explicitly the class "Dialog" in your code. I suggested that I would need a Dialog-Object to get access to my GetNBox-Dialog.
But you get the access to the window of the Dialog by the lines:
HWND hh = GetWindow(OGW_DB_ACTIVE_DLG);
Window wnd(hh);
That works very good. So I dont need the Dialog class, or rather a Dialog-Object, right? Thanks again for this great solution!
|-- TreeNode ...|-- a?? ...|-- ha!! |
Penn |
Posted - 10/28/2010 : 11:44:45 PM Hi TreeNode,
Maybe the current solution is using Dialog as you have mentioned.
Please note that the class Dialog can be used in both standard and Pro version of Origin. Maybe you have to install Developer Kit to make it available. Please refer to Origin's Developer Kit, Installation Developer Kit in Origin 8, OC Programming Guide-Dialog Builder.
Here is an example, you can have a try to see whether it works or not in your computer.
#include <GetNbox.h>
void testDialogGetWindow()
{
GETN_BOX(trTemp)
GETN_NUM(xFrom, "X From", 1.3)
GETN_NUM(xStep, "X Step", -0.5)
GetNBox(trTemp, _normal_event, "Example", NULL, GetWindow());
}
int _normal_event(TreeNode& tr, int nRow, int nEvent, DWORD& dwEnables,
LPCSTR lpcszNodeName, WndContainer& getNContainer, string& strAux,
string& strErrMsg)
{
if( GETNE_ON_INIT == nEvent )
{
HWND hh = GetWindow(OGW_DB_ACTIVE_DLG);
Window wnd(hh);
RECT rr;
wnd.GetWindowRect(&rr);
int width = rr.right-rr.left;
int height = rr.bottom-rr.top;
RECT rr1;
rr1.left = 50;
rr1.right = rr1.left+width;
rr1.top = 50;
rr1.bottom = rr1.top+height;
wnd.MoveWindow(&rr1);
}
return 0;
}
Penn |
|
|