Source language: Translate to:

Restoring Focus to NeoBook

Questions about NeoBook PlugIns

Moderator: Neosoft Support

Restoring Focus to NeoBook

Postby David de Argentina » Fri Feb 22, 2013 12:30 pm

Hi Plugin developer Gurus,

A customer ask me about an odd behaviour of one of my plugins.

He discovered when the plugin is launched, none of the following Neobook actions were executed.

The plugin preserves the focus and still waiting until a click of another neobook objects are pressed.

I tryed to restore the focus to the main neobook program in order to resume the next actions, but does not work.

the secuence of the Plugin actions are:

* Create the dialog, according the rectangle meassurements.

* Show the dialog MODELESS, and catch the Events on a callback function

* On the Callback Function, at the WM_INITDIALOG, i do the initial settings of the dialog. after this i send a private message telling the initialization is complete. the message is:
DIALOG POST CBHNDL, PWM_INIT_COMPLETE, %NULL, %NULL

* When this message is received, i try to restore focus to NeoBook main program using:
SetFocus nbWinHandle

But never the control is focused to the NeoBook program.

Do any know the correct way to return the control to the neobook program ?

Thanks in advance,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: Restoring Focus to NeoBook

Postby Neosoft Support » Fri Feb 22, 2013 1:53 pm

I'm not at my development PC right now, but I think you need to use a different API function like SetActiveWindow.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Restoring Focus to NeoBook

Postby David de Argentina » Fri Feb 22, 2013 8:25 pm

Thanks Dave,
I had tried your suggestion, but not success
Perhaps if i send you a piece of code...
Thanks again,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: Restoring Focus to NeoBook

Postby Neosoft Support » Sat Feb 23, 2013 12:39 pm

Send the code. I can look at it next week.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Restoring Focus to NeoBook

Postby dec » Sat Feb 23, 2013 12:53 pm

Hello,

What about SetForegroundWindow?
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Restoring Focus to NeoBook

Postby dec » Sat Feb 23, 2013 1:17 pm

Hello,

Maybe can use BringWindowToTop?
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Restoring Focus to NeoBook

Postby David de Argentina » Sat Feb 23, 2013 1:39 pm

Thanks DEC,

I tryed:

SendMessage( hDlg, %WM_KILLFOCUS,0,0)
SendMessage( nbWinHandle, %WM_SETFOCUS,0,0)
SetFocus nbWinHandle
SetActiveWindow nbWinHandle
SetForegroundWindow nbWinHandle

But no success...

I sent code to Dave, perhaps he will find the way...

Thanks again,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: Restoring Focus to NeoBook

Postby Garic » Mon Feb 25, 2013 12:01 pm

Project (NB) does not geting control when your dialogue is open, or even after your dialog is closed?
ks
.............
Image
User avatar
Garic
 
Posts: 107
Joined: Wed Sep 26, 2012 8:42 am

Re: Restoring Focus to NeoBook

Postby David de Argentina » Mon Feb 25, 2013 1:22 pm

Hi Garic,

After Dialog is launched, no action of NB project is executed.

NB project actions are executed when a NB Button is clicked.

Thanks for your interest

David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: Restoring Focus to NeoBook

Postby David de Argentina » Tue Feb 26, 2013 11:34 pm

Problem solved.

I think plugin API calls the functions synchronously, it's not going to return control to NeoBook main program until that function returns.

To solve problem, i need call functions Asynchronously - doing something like:

Code: Select all
THREAD CREATE  MyFunction_Start (param) to hThread
....
THREAD CLOSE hThread , 50


I Updated the Sample of NeoMediaPlayer Plugin. On my tests works fine.

Could you test it ? the download link is:

http://specialapps.software-zone.com/fi ... ayerV2.zip

Visible changes to test:

a) at init the program, you must see an alertbox telling the accel keys of the program

b) If you press on the keyboard F1 to F12 keys, some proceses will be done.

Please, tell me if it is working fine for you ( and what OS version you are using...)

Thanks in advance,

David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: Restoring Focus to NeoBook

Postby dec » Wed Feb 27, 2013 12:25 am

Hello,

I try it and apparently work fine. The modal dialog appear showing diferents keys for the program. If press any of this keys until the dialog is show nothing happend. Once we close the modal dialog the program continue working and the refered keys works too. I test on Windows 7 (32 bits) Professional.

Edit: I test again this time on Windows 8 Professional and apparently work well too.
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Restoring Focus to NeoBook

Postby Garic » Wed Feb 27, 2013 10:53 am

Hi David,

I tested on WinXP SP3 - works fine, only very rarely when you quit you get this error:
Image
ks
.............
Image
User avatar
Garic
 
Posts: 107
Joined: Wed Sep 26, 2012 8:42 am

Re: Restoring Focus to NeoBook

Postby David de Argentina » Wed Feb 27, 2013 8:35 pm

Thanks Garic,

Problem detected & solved.

After 7 hours of continue playing with no errors, i think plugin is ready.

Thanks all,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina


Return to PlugIn Discussions

Who is online

Users browsing this forum: No registered users and 4 guests

cron