Sign in to follow this  
Followers 0
tito

Switching focus between objects

10 posts in this topic

hi,

i'm making a fullscreen menu gui; to browse files and the internet from my tv...

It is VERY simple; not a real HTPC, but it should be enough for my needs...

now, the problem I have is :

When I open from the menu an IE object or Edit form, I can't get focus there, until I click it with the mouse...

Or the cursor keys controlling the menu, also control the edit form...

1.

So I don't know how to switch focus between 'main app' VS 'IE object' VS 'other embeded window'

It would be nice if I could switch focus with a key...

2.

Getting an object to switch between fullscreen and embedded would be great to...

pls take a look at my source for other comments too pls; ALL help is welcome :rolleyes:

http://www.mijnesite.be/fullscreen_gui.zip

btw; it's .ziped, because it includes a few files needed for the script...

- flvplayer.html (loads flvplayer.swf)

- flvplayer.swf (freeware .flv player, idea is it'll directly stream youtube/etc flv's instead using their player...)

- sample.flv (110k sample .flv for testing purpose...)

- fullscreen gui.au3 (the script...)

- _XMLDomWrapper.au3 (actually not yet used in script... it'll be used to read youtube XML feads...)

- data.xml (not included but will be generated when loading the youtube XML stream example...)

chrs,

Tito

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I haven't tried your code from the zipfile, but i am guessing ControlFocus would work, have you tried that??

euh... i've learnd a LOT since last post... not from previous posts; but by actually understanding the included readme's/comments :">

so I won't post my next questions (to avoid stupid unpatient questions), but I'll post my progress on my 'project' in this post.

(If not_needed/uninteresting , pls say so... ; althoug I'll love ANY comments on my code...)

Anyway; 'controlfocus' doesnt ring any bells... what do you mean by that ? using a function called 'controlfocus' ?

So I'll would be able to switch focus between IE.object / edit_thing / list_thing / etc ? ... pls explain further....

I'll continiue trying to understand this 'UDF' thing; specificly: this XML 'plugin'...

As far as I understand ; these UDF's are sort of 'plugins'; like .dll; but not quite...

Are "UDF's" comparable to 'classes' in fe PHP ?

As mentioned before; I suceeded in accomplishing what I needed (reading a .xml file) ; but I did by replacing multiple vars in a raw data source (the .xml file), then converting this source into an .ini file. This seams less obvious then actually querying an xml file to get the results needed...

so... ANY help is still welcome...

ps : pls look at my source... I don't even know if my code 'logic' is ok; don't have too much to compare to...

(so included in attachment .zip is my current .au3. Included are some other files.. c previous post...)

http://www.mijnesite.be/tito_test_v02.zip

chrs,

Tito

EDIT : oops !! I thought it was about an other post on this forum :rolleyes: , regarding XML stuff...

http://www.autoitscript.com/forum/index.ph...5&start=165

anyway; question remains... (about focus...)

Edited by tito

Share this post


Link to post
Share on other sites

I will try to answer some of your questions...

1. about focus...

You can read about ControlFocus in the helpfile in your autoit directory or online here

It's generally a good idea to check the helpfile when you are looking for something....

But i felt generous so i made the following code for you to try

HotKeySet("{INS}", "Focuschange") ; I choosed "Insert" since it is so rarely used.....

Func Focuschange()
        $focus1 = ControlGetFocus("My HTPC Experiment")
;       MsgBox(0, "testing", $focus1) Uncomment this to see which control has focus!!
        If $focus1 = "Internet Explorer_Server1" Then ControlFocus("My HTPC Experiment", "", $console)
        If $focus1 = "Edit1" Then ControlFocus("My HTPC Experiment", "", "[CLASSNN:Internet Explorer_Server1]")
EndFunc

Add the HotKeySet and Func to suitable places at your code and then you can change focus between your "Log" and the IE control (You don't have anything in your "Main GUI" that needs focus yet so i skipped that). Note that i used a variable on the first ControlFocus and CLASSNN on the second.

2. UDF??

UDF=User Defined Functions

An udf is a way to define a function often used to make it "easier and faster" to use. They are built into .au3 files that you put in your "\AutoIt3\Include\" directory and is used as normal includes (#include <somethingsomething.au3>)

3. It looks like you are trying to "reinvent" the wheel....

Have you checked out MediaPortal??? It's a complete Media Center and even with a new installed copy it is superior to even Microsoft Vistas Media Center. Oh and it supports plugins so can get it to do anything, including but not limited to a complete file browser, and an internet explorer based browser.

I hope you understand atleast something i have said and have a good week :rolleyes:

Share this post


Link to post
Share on other sites

You can read about ControlFocus in the helpfile in your autoit directory or online here

It's generally a good idea to check the helpfile when you are looking for something....

Idd; help file is first place too look; but I thought I answered to another post about XML... (email notifications got me confused...) so didn't get it... what has focus to do witm xml... :">

But i felt generous so i made the following code for you to try

HotKeySet("{INS}", "Focuschange") ; I choosed "Insert" since it is so rarely used.....

Func Focuschange()
        $focus1 = ControlGetFocus("My HTPC Experiment")
;       MsgBox(0, "testing", $focus1) Uncomment this to see which control has focus!!
        If $focus1 = "Internet Explorer_Server1" Then ControlFocus("My HTPC Experiment", "", $console)
        If $focus1 = "Edit1" Then ControlFocus("My HTPC Experiment", "", "[CLASSNN:Internet Explorer_Server1]")
EndFunc
Thx !! Examples are the best way to explain...

Add the HotKeySet and Func to suitable places at your code and then you can change focus between your "Log" and the IE control (You don't have anything in your "Main GUI" that needs focus yet so i skipped that). Note that i used a variable on the first ControlFocus and CLASSNN on the second.

Thx for the CLASSNN lesson ! :rolleyes:

Btw, does it matter wether I'll use HotKeySet or _ispressed ?

2. UDF??

UDF=User Defined Functions

An udf is a way to define a function often used to make it "easier and faster" to use. They are built into .au3 files that you put in your "\AutoIt3\Include\" directory and is used as normal includes (#include <somethingsomething.au3>)

Ohhh; lol ! I know functions... just didn't heard 'UDF' before, only in autoit...

3. It looks like you are trying to "reinvent" the wheel....

Have you checked out MediaPortal??? It's a complete Media Center and even with a new installed copy it is superior to even Microsoft Vistas Media Center. Oh and it supports plugins so can get it to do anything, including but not limited to a complete file browser, and an internet explorer based browser.

I've checked EVERY media-portal / htpc software out there ... Even tried the paid versions (cracked) ... my conclusion : NONE of them does what I need ...

They all come with extra features and bells I don't need, which makes them slow; and need a lot of tweaking and setting up...

Of all htpc's; media-portal is actually one of the best; but still, not what I need (fe, don't wont tv support, don't want buggy belgian tv guide support, etc, etc, etc)

What I want is :

- filebrowser ; lauching fe media player classic; (already got MPC mapped in gamepad)

- SIMPLE webbrowser, don't even need basic browser functions like back/forward etc, just a list of links and a window to open em in...

- 'online video browser' , fe youtube's 'most popular' .XML ...

and thats about all it needs to do...

I might even just run it windowed on a monitor (using 3 1440x900 screens)

I hope you understand atleast something i have said and have a good week :x

Yep; thx for the 'ControlGetFocus' & 'CLASSNN' ... and I wish u multiple good weeks :rambo:

Chrs,

Tito

Share this post


Link to post
Share on other sites

Btw, does it matter wether I'll use HotKeySet or _ispressed ?

The difference is that HotKeySet locks that key for your script so nothing else can use it while with _ispressed the key is still sent to the app that has the focus..... So it doesn't really matter but things can look really strange when you use _ispressed, for ex start your script and then start some game which "happen" to use the arrow keys and enter and then play that for a few minutes, then exit it and check your script..... I can bet you a hundred dollars, no wait ten, no wait 1 cent :x that you aren't in the same place anymore. :mad:

And well.... Personally i would have used HotKeySet with "rarely used" keys like insert to have the rest available for the internet. But thats just me. :rambo:

(already got MPC mapped in gamepad)

I have been using Media Player Classic some time on my main comp but i have never noticed it can be controlled by gamepad, how did you do that??

and I wish u multiple good weeks

And i wish you..... many multiple good weeks!! :rolleyes:

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I have been using Media Player Classic some time on my main comp but i have never noticed it can be controlled by gamepad, how did you do that??

I use another app for gamepad(s) control...

http://atzitznet.no-ip.org/Joy2Mouse3/

It lets you even bind your own 'shift' keys on the gamepad/joystick...

I now use 1 xbox + 1 ps2 controllers , connected to usb (wireless), binded seperatly

the xbox controller i've binded to all media apps...

shift keys : +L1 = wmp, +L2 = vlc, +R1 = quentessential player (winamp killer), +R2 = misc shortcuts, +nothing = MPC

a,b,x,y, cursor, all dependent from shift key...

thumbstik1 = mouse, thumbstick2 = cursor

etc...

I like this program alot, its lightweight and just sits in systray, all freeware...

It does come with some example configurations, but you'll prob have to rebind for your jostick/gamepad

edit : it obviously just binds to 'keyboard presses' , so you have to bind to the corresponding keyboard shortcut in MPC... no sorta 'direct' MPC support

Edited by tito

Share this post


Link to post
Share on other sites

I use another app for gamepad(s) control...

http://atzitznet.no-ip.org/Joy2Mouse3/

It lets you even bind your own 'shift' keys on the gamepad/joystick...

I now use 1 xbox + 1 ps2 controllers , connected to usb (wireless), binded seperatly

the xbox controller i've binded to all media apps...

shift keys : +L1 = wmp, +L2 = vlc, +R1 = quentessential player (winamp killer), +R2 = misc shortcuts, +nothing = MPC

a,b,x,y, cursor, all dependent from shift key...

thumbstik1 = mouse, thumbstick2 = cursor

etc...

I like this program alot, its lightweight and just sits in systray, all freeware...

It does come with some example configurations, but you'll prob have to rebind for your jostick/gamepad

edit : it obviously just binds to 'keyboard presses' , so you have to bind to the corresponding keyboard shortcut in MPC... no sorta 'direct' MPC support

Why didn't i thought of that?? :rolleyes: thx

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

back to topic...

it's seams the 'Edit1' control sometimes 'takes' focus... don't know why...

but my bigest prob is , how can a put focus on my 'menu' ?

Putting focus on 1 of the labels doesn't work...

i've tried :

Func Focuschange()
; If $focus1 = "Internet Explorer_Server1" Then ControlFocus("My HTPC Experiment", "", $console)
; If $focus1 = "Edit1" Then ControlFocus("My HTPC Experiment", "", "[CLASSNN:Internet Explorer_Server1]")

    $last_focus = $last_focus + 1
    
    If $last_focus = 0 Then
        ControlFocus($program_title, "", $test_dummy_controlhandle)
    ElseIf $last_focus = 1 Then
        ControlFocus($program_title, "", $GUIActiveX)
    ElseIf $last_focus = 2 Then
        ControlFocus($program_title, "", $console)
    Else
    ; ...
    EndIf
    
    If $last_focus > 2 Then $last_focus = 0
; MsgBox(0, "testing", $focus_nu)
    
    $focus_nu = ControlGetFocus("My HTPC Experiment")
    GUICtrlSetData($label_focus, "Focus : " & $focus_nu & "|" & $last_focus)
EndFuncoÝ÷ Û­«­¢+ظ¸¸(ÀÌØí½%ô}%
Éѵ ¤(ÀÌØíU%Ñ¥Ù`ôU%
Ñɱ
ÉÑ=¨ ÀÌØí½%°Í­Ñ½Á]¥Ñ ¼È°Í­Ñ½Á!¥¡Ð¼Ì°Í­Ñ½Á]¥Ñ ¼È°Í­Ñ½Á!¥¡Ð¼È¤(¸¸¸(%]¡¥±Ä($$ÀÌØí½ÕÍ}ѵÀô
½¹Ñɽ±Ñ½ÕÌ ÀÌØíÁɽɵ}ѥѱ¤($$($%U%
ÑɱMÑÑ ÀÌØíÑÍÑ}Õµµä°ÀÌØíÑÍÑ}Õµµå}½¹Ñɽ±¡¹±¤($$($%%ÀÌØí½ÕÍ}ѵÀôÀÌØíU%Ñ¥Ù`=ÈÀÌØí½ÕÍ}ѵÀôÀÌØí½¹Í½±Q¡¸($$%!½Ñ-åMÐ ÅÕ½ÐííUAôÅÕ½Ðì¤($$%!½Ñ-åMÐ ÅÕ½Ðíí=]9ôÅÕ½Ðì¤($$%!½Ñ-åMÐ ÅÕ½Ðíí¹ÑÉôÅÕ½Ðì¤($%±Í($$%!½Ñ-åMÐ ÅÕ½ÐííUAôÅÕ½Ðì°ÅÕ½Ðí5½Ù5¹ÕUÀÅÕ½Ðì¤($$%!½Ñ-åMÐ ÅÕ½Ðíí=]9ôÅÕ½Ðì°ÅÕ½Ðí5½Ù5¹Õ½Ý¸ÅÕ½Ðì¤($$%!½Ñ-åMÐ ÅÕ½Ðíí¹ÑÉôÅÕ½Ðì°ÅÕ½Ðí5¹Õ¹ÑÈÅÕ½Ðì¤($%¹%(%]¹

but that doesn't work...

Edited by tito

Share this post


Link to post
Share on other sites

Posted Image

I've made some progress, and as a beginner/noob, I'd like to hear some comments...

(I know menu is VERY buggy, it can't handle more then 2 keypresses per second...

Prob because the menu works by shifting multiple labels's positions...

It could work if only onscreen labels where calculated , but that's now not the case...

But for that I'll make a seperate include/udf , to handle the gui... now it just does what it is needs to do...)

The gui isn't done yet , only positioning...

To control the menu :

The second item, starting from the top, is the currently selected item... next to the > & <= sings...

-Up/Down = move menu up/down

-Enter = view/download

-Insert = Change focus gui/player (try pressing insert when playing a clip)

-$ = enable/disable HotKeySet...

-Escape = escape...

Now it can :

-Load data 'dynamicly' into the menu...

for now : youtube's top 25 most popular clips

-play .flv stream, (using JW FLV Player) while dowloading

fe : play youtube .flv's in other player

(download progress doesn't work on most youtube servers, with some clips it does work tough...)

-resolution independant, calculated through desktopWidth, desktopHeight, and a custom 'interval'

try commenting out resolutions on top of script...

(not really independant, and no 'nice' gui made yet, just positioning... all labels can/should be replaces by gfx...)

The zip contains :

-fullscreen gui.ai3

-dataripper_profile.ini (small config file to manually convert XML 2 INI)

-img/default.jpg

-img/youtube_logo.jpg

-temp/flvplayer.swf

-temp/playerTemplateFLV.html

the app will create (in working dir)

-data.xml

-data.ini

in temp dir :

-TEMPflvplayer.html

-all downloaded .flv files

img dir :

-all downloaded thumbnails

(to counter all virus warnings...)

it IS verry buggy, no error checking, and slow , ... it's just an idea; but ALL comments are welcome

-fe, how should I handle the (moving) menu ?

-Best way to switch focus ?

-What control scheme to use ? need fullscreen/smallscreen/noscreen switch + focus IE/menu, not using too many buttons...

-Is switching object between HIDE/SHOW a good idea ? should I also enable/disable em ?

-etc

-are my 'loops' and 'functions' etc logical ?

-don't I loop through tooooo many arrays ?

(btw, no, I dont wan't to make a full htpc, ... , just a basic lightweight 'internet-tv viewer/local media browser' , to be used on a tv...)

Lightweight, meaning I could just run it from anywhere, no install, no massive configs, no tv support, as it is to be used With a tv... , and be able to quit the app, without leaving traces so I can use my pc for other things... like it was never there...

pls take a look at my code and help a rookie out...

thx in advance...

Tito

titoGUIv1.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0