Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

Handling focus in eo:WebControl Options
Christian Porzio
Posted: Wednesday, November 28, 2018 4:08:23 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 83
Hi,

This may sound like a pure WPF/C# question but I cannot get it to work here.

I am trying to do something very simple: handle the gotfocus event when my EO Web form gets the focus - either from keyboard or mouse action.

I do receive those event from my window, but that is not good enough when that window contains multiple EO WebForm controls.

This is what my window looks like - manually rebuilt the XAML composite:
Code: HTML/ASPX
<Grid>
	<myControls:AABrowserWindow x:Name="BrowserWindow" Grid.Row="0">
		<Grid x:Name="gridWeb" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
			<Grid.Background>
				<ImageBrush x:Name="loadingBckGrndImg" ImageSource="Resources/047_787 exterior_DSC1681_a_RGB.jpg" Stretch="UniformToFill"/>
			</Grid.Background>
			<Grid x:Name="containerGrid">
				<Image x:Name="waitGif" 
				gif:ImageBehavior.AnimatedSource="Resources/circle-loading-animation.gif" 
				gif:ImageBehavior.RepeatBehavior="Forever" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="1.58,0.944" Panel.ZIndex="1" Stretch="None"/>
				<Grid>
					<eo:WebControl x:Name="webContainer" Foreground="White" Margin="0" Panel.ZIndex="10"/>
				</Grid>
			</Grid>
		</Grid>
	</myControls:AABrowserWindow>
</Grid>

I tried to handle a GotFocus at every level of each one of those component. But it never gets fired.

I am able to capture the window FOCUS/KILL_FOCUS messages but that is not what I am looking at because I can have multiple form in my window and I still do not know if any of those form is or is not in focus.

Would you have a suggestion for this?

Thanks a lot!
eo_support
Posted: Friday, November 30, 2018 9:42:09 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,821
Hi,

I am not sure if I understand your question correctly. You might be confusing about the WebControl as a whole and individual elements inside the page that is loaded in the WebControl. Any event on the WebControl/WebView treats the whole WebControl as a single unit. So if you have two input boxes inside a single page that's loaded inside a single WebView, then:

1. Switching focus from anything OUTSIDE of the WebView (such as a regular WPF TextBox in you Window) to either of the textbox INSIDE of the WebView will trigger GotFocus event;
2. Switching between the two textboxes inside the WebView will NOT trigger GotFocus event since the focus status for the WebView as a whole did not change;

If you want to catch focus change inside your page, you will need to do it with JavaScript and that would not have anything directly with the WebView. The WebView would only provide support for you to run/inject JavaScript into the page in this case.

Thanks!
Christian Porzio
Posted: Friday, November 30, 2018 4:37:08 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 83
Thank you.

I was able to assign window.onfocus and window.onblur to a callback.

I guess I thought the .Net EO.Web instance would have provided such handlers.

The only issue I have with using this callback approach is that it might break an existing handler in the loaded page.

We will need eventually to make it a bit smarter by checking if those window's handlers point to an existing function and if it does, then call that function first, and our callback then.

In any cases, thank you for your inputs, it allowed me to unlock the situation.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.