The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Where to submit suspected bugs?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Frank_H

Germany
Posts

Posted - 04/07/2005 :  10:54:23 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi!

Could not find a link on the OriginLab web site to submit a (suspected) bug. Where do I do it?
As some of the developers read this forum:
Executing the following code

Layer lay = Project.ActiveLayer();
Page pg = lay.GetPage();
Window win = pg.GetWindow();
RECT rect;
win.GetWindowRect(&rect);
win.MoveWindow(&rect);

shifts the active Window, although the coordinates in rect are not changed. My suspicion is: GetWindow calculates the coordinates with respect to the complete Origin window (including menus and toolbars), while MoveWindow interprets the coordinates with respect of the upper left corner of the workspace, without frame, menus and toolbars.

By the way, I implemented a routine to set the window size with an image inside to an optimal 1:1 pixel ratio. But as the GetWindowRect gives me the outer window dimensions including frame and header, I used LabTalk.page.width/height to get the inner dimensions. It works fine, but is there a OriginC possibility to get the usable window size?

Cheers,
Frank


Origin Version (Select Help-->About Origin): 7.5, SR5
Operating System:Win XP

eparent

118 Posts

Posted - 04/08/2005 :  11:16:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Frank,

The GetWindowRect method will get a rectangle containing screen coordinates. The MoveWindow method expects a rectangle with coordinates relative to the parent window.

The following code snippet will show you how to convert coordinates. The code is similar to your code but the window will not move as you expected to see with your code.


// Get rectangle for active child window.
Page pg = Project.Pages();
Window winChild = pg.GetWindow();
RECT rectChild;
winChild.GetWindowRect(&rectChild);

// Get parent window of active page.
Window winParent = winChild.GetParent();

// Convert child's screen coordinates to coordinates
// relative to parent window.
winParent.ScreenToClient(&rectChild);

// Move child window.
winChild.MoveWindow(&rectChild);


You are correct. The GetWindowRect gets the rectangle for the entire window. This includes borders, caption, menu, etc. If you want just the area used for displaying data then you can call the GetClientRect method. Comparing the rectangles returned by GetClientRect and GetWindowRect will allow you to determine the size of a window's borders. You will also find the ClientToScreen method useful too.


Edited by - eparent on 04/08/2005 11:17:45 AM
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 04/11/2005 :  3:31:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Frank,

> Could not find a link on the OriginLab web site to
> submit a (suspected) bug. Where do I do it?

Please report a bug to:
http://www.originlab.com/www/company/qform.aspx?s=1&
in category of Origin Technical Support (or Product Suggestions/Feature Request)

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 04/11/2005 3:31:47 PM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000