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
 Origin Forum
 How to get the active window name?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

rezahasi1

Bangladesh
Posts

Posted - 08/10/2005 :  07:06:53 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version : 7.5 SR5
Operating System:WinXP

For worksheet, I tried below
invoke(originObj, 'Execute', '%z=""; doc -e w {%z= %h};');strGraphNames = invoke(originObj, 'LTStr', '%z')

But it always gives the recently created worksheet name.
It appears that it always give the worksheet name created most recently, NOT the active one.

Any advice would be suggested
Thanks
REZA

Mike Buess

USA
3037 Posts

Posted - 08/10/2005 :  08:51:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The LabTalk string variable %H always holds the name of the active window. Use this in OriginC...

string sName = Project.Pages().GetName();

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 08/10/2005 08:57:55 AM
Go to Top of Page

rezahasi1

Bangladesh
Posts

Posted - 08/10/2005 :  09:15:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks, but interestingly %H doest not do that AT LEAST in my case.
I had to use origin as actxserver. I can get all window names but not the CURRENT ONE ONLY which are selected by mouse or on top.

Possibly, I can't use GetName property when in actxserver, right?
thanks anyway
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 08/10/2005 :  10:28:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
interestingly %H doest not do that AT LEAST in my case.
That's odd, because it obviously worked in your original script - doc -e W {%Z=%H} - which is the usual LT method for finding the name of the most recently created window. I've never used ActiveX, but I would guess that the script could be modified like this...

strGraphNames = invoke(originObj, 'LTStr', '%h')

Mike Buess
Origin WebRing Member
Go to Top of Page

rezahasi1

Bangladesh
Posts

Posted - 08/10/2005 :  11:52:11 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mr Buess,
As you suggested, strGraphNames = invoke(originObj, 'LTStr', '%h'), this one works giving the top most selected window title. It almost serves my purpose, since it collects any window (Worksheet, graph, matrix whatever). I actually wanted to get the top most worksheet only.

Thank you very much for the kind help.

REZA
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 08/11/2005 :  08:14:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi REZA,

The concept of the "top most worksheet" window has no meaning. There is only one active window which, as you say, can be wks, graph, matrix or layout. You can find out what type of window it is with the exist() function.

if( exist(%H,2) ) ty "%H is a wks window";
else ty "%H is not a wks window";

Mike Buess
Origin WebRing Member
Go to Top of Page

rezahasi1

Bangladesh
Posts

Posted - 08/14/2005 :  11:13:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Great!, Thank you very much
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