[Gambas-user] New to Gambas - coding question how to find the active window on an Ubuntu 7.10 desktop

Khos kim.hoskin at ...1073...
Sun Jan 20 20:26:37 CET 2008


Thanks Jose and Oh master of Gambas :)

I will have a look at Jose's info but Benoit.. I have tried to use
Desktop.Find() but the documentation was not so understandable for me. It
would seem like a much simpler way with this. Does this function get all the
windows titles and put it into an array? if so how would you know which one
is the active window? there are no sample codes on how to use this function,
unless you could point to some, I would appreciate your efforts very much :)

Many thanks for the help so far folks!
Kind regards
Kim


Benoit Minisini wrote:
> 
> On dimanche 20 janvier 2008, José Luis Redrejo wrote:
>> 2008/1/20, Khos <kim.hoskin at ...1073...>:
>> > Hi Jose,
>> >
>> > I emailed you direct but if there is anyone else who can provide input
>> > that
>> > would be great. Am I correct in thinking that your 2 lines of code:
>> > SHELL "xwininfo -name \"" & title & "\"| grep \"Window id\" " to
>> result1
>> >   'result1=xwininfo: Window id: 0x3201eca "title"
>> >
>> > Will give me the active window's title on the Ubuntu desktop (any
>> > app/window)?
>>
>> Only the first line, the second one is commented. It was just a comment
>> for
>> me to remember the
>> returning value of xwininfo. Here you have an example of how it works if
>> you execute it in a terminal:
>>
>> jose at ...1836...:~$ xwininfo -name "monitor - Gambas II"| grep "Window id"
>> xwininfo: Window id: 0x3c0000c "monitor - Gambas II"
>>
>>
>> Does xwininfo program give all the info(ID/Title etc) that the mouse is
>>
>> > hovering over?
>>
>> if you take a look to "man xwininfo" you will see that you have to pass
>> it
>> the window name or the window id and it will return all the data about
>> the
>> window. You can also use it just clicking on the selected window to get
>> all
>> the information. The way I use it in this code is passing the window name
>> to get the window id, as the Embedder control needs the window id. I know
>> the window name because it's launched using shell from the same
>> application. Depending on your needs you have to choose between the
>> different options to use xwininfo.
>>
>> Regards.
>> José L.
> 
> To find a window id from its title, you can use the Desktop.Find() method
> of 
> the gb.desktop component.
> 
> Regards,
> 
> -- 
> Benoit Minisini
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> 

-- 
View this message in context: http://www.nabble.com/New-to-Gambas---coding-question-how-to-find-the-active-window-on-an-Ubuntu-7.10-desktop-tp14931902p14985624.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list