View Issue Details

IDProjectCategoryView StatusLast Update
0009059MMW v4Framework: Scripts/Extensionspublic2012-02-02 09:29
Reporterzvezdan Assigned To 
PriorityhighSeverityminorReproducibilityalways
Status newResolutionopen 
Summary0009059: Several ActiveX Web Browser control issues
DescriptionThere are several issues with the ActiveX Web Browser control that I am experiencing since MM2, but I am reporting them just now. I could avoid some of them using some HTML code or some of MM methods, but not all. Here is the test code:

Option Explicit

Dim oLabel

Sub OnStartUp()
    Dim mnuTest

    Set mnuTest = SDB.UI.AddMenuItem(SDB.UI.Menu_Edit, 0, 0)
    mnuTest.Caption = "Zvezdan's Test"
    mnuTest.OnClickFunc = "TestForm"
    mnuTest.UseScript = Script.ScriptPath
End Sub

Sub TestForm(Item)
    Dim oForm, oCtrl, sTmp

    Set oForm = SDB.UI.NewForm
    oForm.Common.SetRect 100, 100, 360, 470
    oForm.BorderStyle = 3
    oForm.FormPosition = 4
    oForm.Caption = "Zvezdan's Test"

    Set oLabel = SDB.UI.NewLabel(oForm)
    oLabel.Common.SetRect 20, 10, 300, 17

    Set oCtrl = SDB.UI.NewEdit(oForm)
    oCtrl.Common.SetRect 20, 40, 300, 21
    oCtrl.Text = "Using ActiveX?"
    oCtrl.Common.ControlName = "EditBox"
    Script.RegisterEvent oCtrl.Common, "onEnter", "Common_OnEnter"

    Set oCtrl = SDB.UI.NewActiveX(oForm, "Shell.Explorer")
    oCtrl.Common.SetRect 20, 75, 300, 120
    sTmp = "<html><head><style type='text/css'>" _
            & "textarea {font: 12px 'Courier New' monospace; border: 1px solid; " _
            & "position: absolute; left:10px; top:10px; width:276px; height:96px; " _
            & "overflow: auto;} " _
            & "body {overflow: hidden;}" _
            & "</style><body><textarea>For this test cycle, we're opening up our bug tracking system (read-only to begin with) to give better visibility on issue statuses and plans. A full list of changes in 3.1 appears on our changelog . We're also going to post 'internal' builds on a regular basis so that there aren't long gaps between formal Alpha & Beta builds. 'Internal' builds will include the most recent changes, but will not necessarily have been tested, giving the more adventurous among you a chance to try out the same software that the developers are using." _
            & "</textarea></body></html>"
    oCtrl.SetHTMLDocument sTmp
    oCtrl.Common.ControlName = "WebBrowser1"
    Script.RegisterEvent oCtrl.Common, "onEnter", "Common_OnEnter"

    Set oCtrl = SDB.UI.NewActiveX(oForm, "Shell.Explorer")
    oCtrl.Common.SetRect 20, 210, 300, 70
    sTmp = "<html><head><style type='text/css'>" _
            & "select {font: 11px 'Tahoma'; " _
            & "position: absolute; left:10px; top:10px; width:276px; height:46px;}" _
            & "body {overflow: hidden;} " _
            & "</style><body><select size = '100'>" _
            & "<option>Volvo</option>" _
            & "<option>Saab</option>" _
            & "<option>Mercedes</option>" _
            & "<option>Audi</option>" _
            & "</select></body></html>"
    oCtrl.SetHTMLDocument sTmp
    oCtrl.Common.ControlName = "WebBrowser2"
    Script.RegisterEvent oCtrl.Common, "onEnter", "Common_OnEnter"

    Set oCtrl = SDB.UI.NewActiveX(oForm, "Shell.Explorer")
    oCtrl.Common.SetRect 20, 295, 300, 60
    sTmp = "<html><head><style type='text/css'>" _
            & "textarea {font: 12px 'Courier New' monospace; border: 1px solid; " _
            & "position: absolute; left:10px; top:10px; width:276px; height:36px; " _
            & "overflow: auto;} " _
            & "body {overflow: hidden;}" _
            & "</style><body><textarea>For this test cycle, we're opening up our bug tracking system (read-only to begin with) to give better visibility on issue statuses and plans." _
            & "</textarea></body></html>"
    oCtrl.SetHTMLDocument sTmp
    oCtrl.Common.ControlName = "WebBrowser3"
    oCtrl.Common.Enabled = False
    Script.RegisterEvent oCtrl.Common, "onEnter", "Common_OnEnter"

    Set oCtrl = SDB.UI.NewCheckBox(oForm)
    oCtrl.Caption = "Using ActiveX?"
    oCtrl.Common.SetRect 20, 370, 300, 17
    oCtrl.Common.ControlName = "CheckBox"
    Script.RegisterEvent oCtrl.Common, "onEnter", "Common_OnEnter"

    Set oCtrl = SDB.UI.NewButton(oForm)
    oCtrl.Caption = "&Close"
    oCtrl.Common.SetRect 150, 400, 73, 25
    oCtrl.UseScript = Script.ScriptPath
    oCtrl.Cancel = True
    oCtrl.modalResult = 2
    oCtrl.Common.ControlName = "Button"
    Script.RegisterEvent oCtrl.Common, "onEnter", "Common_OnEnter"

    oForm.showModal
End Sub

Sub Common_OnEnter(oCtrl)
    oLabel.Caption = oCtrl.Common.TopParent.ActiveControl
End Sub
Steps To ReproduceProblem 1 - Web browser control doesn't transfer keyboard focus to the first active element on the html page even if it contains only one element:
- click on the edit box on the top;
- press Tab key several times -> when some Web browser take a focus it cannot be used with the keyboard, e.g. you could not edit text in the textarea element, not you could change row of the select element by press on Up/Down keys.

I have resolved that problem in my scripts using MM OnEnter event for Web control and oWebCtrl.Interf.document.body.firstChild.focus. However, such solution is unpractical especially because that line cannot be used directly inside of the OnEnter event handler, but I need to create one new Timer control for delayed execution.

Problem 2 - Web control with the textarea element (multiline textbox) lose focus when moving text cursor:
- click on the Web control 1 somewhere in the middle;
- press Up or Down key several times -> when you reach the top (Up key) or bottom (Down key) the Web control will transfer keyboard focus to the previous/next control.

I have resolved that problem in my scripts intercepting OnFocusOut event of the textarea element.

Problem 3 - Web control with the select element (listbox) doesn't respond on the first mouse click with the skinned version of the program:
- click on the edit box on the top;
- click on the unselected row in the listbox of the second Web control -> nothing is happening, although you could see in the label on the top that ActiveControl is WebBrowser2;
- click again on the same row of the listbox and it will be changed.

I have resolved that using OnMouseDown event of select element.

Problem 4 - When you hover a mouse over the border of the select element (listbox) in the Web control the mouse cursor would change to the arrow with the small hourglass. This cannot be avoided.

Problem 5 - with the skinned version of the program if you have some edit box active and after you click on some disabled Web control it will become the active control. Other disabled MM controls don't behave like that:
- click on the edit box on the top;
- click on the third Web control which is disabled -> you could see in the label on the top that active control is Web control 3.

You could even edit the text in the textarea element of that control, which I could avoid using oCtrl.Interf.document.body.firstChild.disabled = False, but the active control would be still disabled Web control.

However, if you cycle through controls with the Tab key you would see that disabled Web control would be skipped as it should.

Problem 6 - with the skinned version of the program the active control is not changed when you click on some Web control after some another Web control:
- click on the edit box on the top;
- click on the first Web control;
- click on the second Web control -> you could see in the label on the top that active control is still Web control 1.

however:
- click on the edit box on the top;
- click on the first Web control;
- click on the edit box on the top again;
- click on the second Web control -> active control is now Web control 2.

I have resolved that using OnMouseDown event of Web element and set of oCtrl.Common.TopParent.ActiveControl = "xx"


Problem 7 - with the skinned version of the program the checkbox or button control stays active even when you click on some Web control; with the non-skinned version even the editbox control stays active when you click on some Web control, i.e. with the non-skinned version you cannot activate some Web control with a mouse at all, but only with Tab key:
- click on the check box on the bottom;
- click on some Web control -> you could see in the label on the top that the active control is still the check box (however the keyboard would affect the clicked Web control, e.g. editing of the textarea element);
- if you press Tab button, the Close button on the bottom would become active, but not the next control after the Web control which has the keyboard focus.

The solution which I have for the previous problem resolves this one as well.

OK, you could say that almost all those problems have some kind of solution which could be implemented in the script, but I spent countless hours to find them. Anyway, in my opinion the scripters shouldn't do that when it is up to you to resolve problems in the program itself.
TagsNo tags attached.
Fixed in build

Relationships

related to 0010156 closedpetr Web pages get 'stuck' while rendering (regression) 

Activities

There are no notes attached to this issue.