<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.parker.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>InteractX - How does one create a browser control that looks like the message display?</title><link>https://community.parker.com/technologies/electromechanical-group/f/support/416/interactx---how-does-one-create-a-browser-control-that-looks-like-the-message-display</link><description> I have source data that will be getting formatting in HTML and may contain links to images (Safety placards) 
 Previously we&amp;#39;ve been using a messagedisplay (Object/element on the right) as it has been plain text data - plain text displays well and the</description><dc:language>en-US</dc:language><generator>Telligent Community 11</generator><item><title>RE: InteractX - How does one create a browser control that looks like the message display?</title><link>https://community.parker.com/thread/801?ContentTypeID=1</link><pubDate>Tue, 27 Apr 2021 16:57:54 GMT</pubDate><guid isPermaLink="false">0106ae23-cc79-4508-aede-1a85d082af26:e2cba4b5-1b40-4639-a19c-4b6399970175</guid><dc:creator>Daniel Cliffe</dc:creator><description>&lt;p&gt;Creative.&amp;nbsp; I like it!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: InteractX - How does one create a browser control that looks like the message display?</title><link>https://community.parker.com/thread/800?ContentTypeID=1</link><pubDate>Tue, 27 Apr 2021 16:32:31 GMT</pubDate><guid isPermaLink="false">0106ae23-cc79-4508-aede-1a85d082af26:a6e88c56-0f47-4000-9826-0c8664f5f16c</guid><dc:creator>Some rando control guy</dc:creator><description>&lt;p&gt;Broadly speaking I am calling Windows API methods for manipulating the mouse cursor location and click events&lt;/p&gt;
&lt;p&gt;When the browser control is clicked, I use the VB &amp;quot;Sendkeys&amp;quot; function to send page up / down or the arrow up / down keys.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Here is what I&amp;#39;ve ended up doing:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/21/Instructions-2.png" /&gt;&lt;/p&gt;
&lt;p&gt;On this panel, there is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;an &amp;quot;Action button&amp;quot; for exiting the runtime&lt;/li&gt;
&lt;li&gt;2x &amp;quot;Discrete button&amp;quot;&amp;nbsp;
&lt;ul&gt;
&lt;li&gt;&amp;quot;Scroll up&amp;quot; (called btnPageUp in VBA)&lt;/li&gt;
&lt;li&gt;&amp;quot;Scroll down&amp;quot;&lt;span&gt;&amp;nbsp;(called&amp;nbsp;&lt;/span&gt;&lt;span&gt;btnPageDown in VBA)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span&gt;a browser control (called BrowserDisplay001)&amp;nbsp;&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&amp;quot;Type and Action&amp;quot; in the object properties (Machine shop window - not VBA)&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&amp;quot;Expression&amp;quot; radio button set&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;URL_Tag is &amp;quot;URL_for_display&amp;quot;&amp;nbsp; (This tag will&amp;nbsp;hold a file path and name)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span&gt;a message display&amp;nbsp;(Just to show the frame around the browser and buttons)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;In the project, I have created a module that exposes the Windows API via public functions.&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;VBA module: VirtualMouse&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Option Explicit&lt;/p&gt;
&lt;p&gt;Public Const MOUSEEVENTF_LEFTDOWN As Long = &amp;amp;H2&lt;br /&gt; Public Const MOUSEEVENTF_LEFTUP As Long = &amp;amp;H4&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; Public Const MOUSEEVENTF_RIGHTDOWN As Long = &amp;amp;H8&lt;br /&gt; Public Const MOUSEEVENTF_RIGHTUP As Long = &amp;amp;H10&lt;br /&gt; &lt;br /&gt;&amp;#39; Access the GetSystemMetrics32 function in user32.dll to get the screen size (Pixels)&lt;br /&gt; &lt;strong&gt;Public Declare Function GetSystemMetrics32&lt;/strong&gt; Lib &amp;quot;User32&amp;quot; _&lt;br /&gt; Alias &amp;quot;GetSystemMetrics&amp;quot; (ByVal nIndex As Long) As Long&lt;/p&gt;
&lt;p&gt;&amp;#39; Access the GetCursorPos function in user32.dll - &amp;quot;Where did they click&amp;nbsp;on the screen?&amp;quot;&lt;br /&gt; &lt;strong&gt;Public Declare Function GetCursorPos&lt;/strong&gt; Lib &amp;quot;User32&amp;quot; _&lt;br /&gt; (lpPoint As POINTAPI) As Long&lt;/p&gt;
&lt;p&gt;&amp;#39; Access the SetCursorPos function in user32.dll - &amp;quot;Where do you want to place the mouse pointer?)&lt;br /&gt; &lt;strong&gt;Public Declare Function SetCursorPos&lt;/strong&gt; Lib &amp;quot;User32&amp;quot; _&lt;br /&gt; (ByVal x As Long, ByVal y As Long) As Long&lt;br /&gt; &lt;br /&gt;&amp;#39; Access the mouse_event function in user32.dll - &amp;quot;Make the OS think a mouse did something&amp;quot;&lt;br /&gt; &lt;strong&gt;Public Declare Sub mouse_event&lt;/strong&gt; Lib &amp;quot;User32&amp;quot; _&lt;br /&gt; (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)&lt;br /&gt; &lt;br /&gt;&amp;#39; Access a sleep function that can use milliseconds in kernel32&lt;br /&gt; &lt;strong&gt;Public Declare Sub Sleep&lt;/strong&gt; Lib &amp;quot;kernel32&amp;quot; (ByVal dwMilliseconds As Long)&lt;br /&gt; &amp;#39; Usage: Sleep t&lt;/p&gt;
&lt;p&gt;&amp;#39; GetCursorPos/SetCursorPos requires a variable declared as a custom data type that will hold two integers, one for x value and one for y value&lt;br /&gt; &lt;strong&gt;Public Type POINTAPI&lt;/strong&gt;&lt;br /&gt; X_Pos As Long&lt;br /&gt; Y_Pos As Long&lt;br /&gt; End Type&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;&lt;span&gt;Panel VBA&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Dim SavedCursor As POINTAPI&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Private Sub Panel_Activate()&lt;/strong&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Tags.URL_for_Display.Value = &amp;quot;&lt;span&gt;&lt;em&gt;[Some local folder on the PC]&lt;/em&gt;&lt;/span&gt;\instructions.htm&amp;quot;&lt;br /&gt; &lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Private Sub btnPageDown_ButtonPressed()&lt;/strong&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetCursorPos SavedCursor&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;#39; Get browser middle coordinates and click once on it (To set focus for sending the navigation keys)&lt;br /&gt; GetBrowserMidPos&lt;br /&gt; &lt;br /&gt; DoEvents&lt;br /&gt; SendKeys &amp;quot;{DOWN}&amp;quot;&lt;br /&gt; &lt;br /&gt; SetCursorPos SavedCursor.X_Pos, SavedCursor.Y_Pos&lt;br /&gt; &lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Private Sub btnPageUp_ButtonPressed()&lt;/strong&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetCursorPos SavedCursor&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetBrowserMidPos&lt;br /&gt; &lt;br /&gt; DoEvents&lt;br /&gt; SendKeys &amp;quot;{UP}&amp;quot;&lt;br /&gt; &lt;br /&gt; SetCursorPos SavedCursor.X_Pos, SavedCursor.Y_Pos&lt;br /&gt; &lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Private Sub GetBrowserMidPos()&lt;/strong&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;#39; Positions and dimensions reurned to VBA are NOT always the same as the cursor cordinates.&lt;br /&gt; &amp;#39; * Cursor cordinates are in &amp;#39;pixels&amp;#39;&lt;br /&gt; &amp;#39; * VBA cordinates are in pixels when configured - BUT ...&lt;br /&gt; &amp;#39; Panel resolution set at 800x600 with &amp;quot;scale to runtime resolution&amp;quot; enabled (This is the basis for the VBA co-ord)&lt;br /&gt; &amp;#39; Screen maybe running 1920 x 1080 - the cursor postion uses this&lt;br /&gt; &amp;#39; SCALING VBA SIZE to SCREEN SIZE is needed for the mouse click!&lt;br /&gt; &lt;br /&gt; Dim BrowserMid As POINTAPI&lt;br /&gt; Dim PanelSize As POINTAPI&lt;br /&gt; Dim ScreenSize As POINTAPI&lt;br /&gt; &lt;br /&gt; &amp;#39; Insert VBA position&lt;br /&gt; BrowserMid.X_Pos = BrowserDisplay001.Left + (BrowserDisplay001.Width / 2)&lt;br /&gt; BrowserMid.Y_Pos = BrowserDisplay001.Top + (BrowserDisplay001.Height / 2)&lt;br /&gt; &lt;br /&gt; &amp;#39; Find screen x and y sizes (Numbers returned match the display resolution in windows OS &amp;quot;Display properties&amp;quot;)&lt;br /&gt; ScreenSize.X_Pos = GetSystemMetrics32(0) &amp;#39; width in points&lt;br /&gt; ScreenSize.Y_Pos = GetSystemMetrics32(1) &amp;#39; height in points&lt;br /&gt; &lt;br /&gt; PanelSize.X_Pos = Me.Width&lt;br /&gt; PanelSize.Y_Pos = Me.Height&lt;br /&gt; &lt;br /&gt; &amp;#39; Scale the browser mid position&lt;br /&gt; BrowserMid.X_Pos = BrowserMid.X_Pos * ScreenSize.X_Pos / PanelSize.X_Pos&lt;br /&gt; BrowserMid.Y_Pos = BrowserMid.Y_Pos * ScreenSize.Y_Pos / PanelSize.Y_Pos&lt;br /&gt; &lt;br /&gt; &amp;#39; Place the mouse cursor over the midpoint of the browser&lt;br /&gt; SetCursorPos BrowserMid.X_Pos, BrowserMid.Y_Pos&lt;br /&gt; &lt;br /&gt; &amp;#39; Left click once&lt;br /&gt; Sleep 200 &amp;#39; A delay of 100ms was not long enough for the mouse click to set focus&lt;br /&gt; mouse_event MOUSEEVENTF_LEFTDOWN, 0&amp;amp;, 0&amp;amp;, 0&amp;amp;, 0&amp;amp;&lt;br /&gt; mouse_event MOUSEEVENTF_LEFTUP, 0&amp;amp;, 0&amp;amp;, 0&amp;amp;, 0&amp;amp;&lt;br /&gt; &lt;br /&gt;End Sub&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: InteractX - How does one create a browser control that looks like the message display?</title><link>https://community.parker.com/thread/796?ContentTypeID=1</link><pubDate>Mon, 26 Apr 2021 21:01:50 GMT</pubDate><guid isPermaLink="false">0106ae23-cc79-4508-aede-1a85d082af26:7ebcb366-fcec-4b95-92be-786b720037cc</guid><dc:creator>Daniel Cliffe</dc:creator><description>&lt;p&gt;I didn&amp;#39;t think to check for a WebKit or Chromium ActiveX control, but agree that that would be the most elegant solution.&amp;nbsp; It looks like webkitx.com has an option available for a fee.&lt;/p&gt;
&lt;p&gt;Simply launching the browser with a URL argument is certainly much easier.&amp;nbsp; If you are an ambitious Visual Studio user, you could also look at doing a stripped-down WebKit/Chromium ActiveX wrapper for just the components you need.&amp;nbsp; Would require significant work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: InteractX - How does one create a browser control that looks like the message display?</title><link>https://community.parker.com/thread/795?ContentTypeID=1</link><pubDate>Mon, 26 Apr 2021 19:32:21 GMT</pubDate><guid isPermaLink="false">0106ae23-cc79-4508-aede-1a85d082af26:4f9e253e-cbd0-44af-9043-475da21f4c4b</guid><dc:creator>Some rando control guy</dc:creator><description>&lt;p&gt;The message list doesn&amp;#39;t sound feasible. I am going to be pulling the HTML formatted text from a database field that will be updated daily. Its table contains over 8,000 rows.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Your answer pointed me to evaluating alternative methods. I looked at pulling in a different ActiveX control (Webkit or Chrome for example) but landed on making do with the native browser control.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The solution is a bit of a bodge, and is just missing the camouflaged duck tape. I will share a sanitised version here as a separate answer to possibly save someone else a lot of hours work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: InteractX - How does one create a browser control that looks like the message display?</title><link>https://community.parker.com/thread/790?ContentTypeID=1</link><pubDate>Tue, 20 Apr 2021 20:14:04 GMT</pubDate><guid isPermaLink="false">0106ae23-cc79-4508-aede-1a85d082af26:1b419a06-fe9e-4da5-bb3e-9776e6b71791</guid><dc:creator>Daniel Cliffe</dc:creator><description>&lt;p&gt;I don&amp;#39;t think there is a way to do this.&amp;nbsp; The browser in InteractX is an ActiveX frame containing a version of Internet Explorer.&amp;nbsp; I checked out some of the properties the control supports to see if you could do this by loading it manually, but I don&amp;#39;t see an option to hide the scroll bars or change their size, nor do I see an option to scroll the page using external controls.&lt;/p&gt;
&lt;p&gt;Sorry, I know this is not the answer you were hoping for.&lt;/p&gt;
&lt;p&gt;Not sure if it will work for what you are doing, but the message tool can be used to display message lists as well.&amp;nbsp; A message list has a fixed number of messages selected using an integer tag.&amp;nbsp; Each message supports its own formatting, so you could make one message bold red and another one italic green, for instance.&amp;nbsp; There are limitations, though.&amp;nbsp; The entire message must have the same format and message lists can only be configured in InteractX development, so it is harder to do hot updates.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>