Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic dropdown list in webbrowser control
Message
From
19/04/2004 12:34:30
Mike Sue-Ping
Cambridge, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00896067
Message ID:
00896184
Views:
22
Gerald,

Got it! I was trying to set the innerhtml for the options object when I should have been setting it for the entire span so that I included the Select tags too. I clued in after re-reading your suggestion to use a span. Although I was doing the latter, I wasn't approaching the innerhtml correctly.

Thanks for the spark...

Mike

>My previous comment was about my experience using innerHTML in javascript.
>Directly in VFP it could be different of course :)
>
>I dont see any problem with the use of the innerHTML of a span tag to create the entire list in one shot.
>
>May be you have a misplaced " or ' somewhere in the creation code of the list?
>
>
>
>>I've been using .innerhtml (all lowercase) from within VFP methods and never had any problems (till now I guess). I'm using it in several custom methods of the same form and all work correctly. I change the contents of several span tags throughout the document and my code is all lowercase.
>>
>>Do you know if the dropdownlist is the only control that is picky about this stuff?
>>
>>I'll give it a try anyway.
>>
>>
>>Mike
>>
>>
>>
>>
>>
>>>Be carefull with the case of the text, use "innerHTML" with "inner" lowercase and "HTML" uppercase...
>>>No error, but it does nothing if you are not using the right case.
>>>
>>>HTH :)
>>>
>>>>Tried it already. Actually, it was my first thought and attempt to make the dynamic list. For some reason, it simply does not work. No errors occur, but, no list either. The new list appears very narrow with nothing in its dropdown. I can't explain why.
>>>>
>>>>I've suspended the code in VFP and checked the dropdownlist.innerhtml contents. I've done this just prior to rebuilding it and when I compare the original to what I recreate, the innerhtml looks no different other than the fact that the strings are not the same. ie the tags look identical, but obviously, the text and values are different. It just refuses to show anything in the list after I set innerhtml.
>>>>
>>>>Have you ever tried or seen this?
>>>>
>>>>Mike
>>>>
>>>>
>>>>>Why dont you create the complete list in a string and assing it in one call.
>>>>>The simplest way to do this is via a span tag with an id.
>>>>>
>>>>>
>>>>><span id=mylist>
>>>>><select ...>
>>>>><option>...
>>>>></select>
>>>>></span>
>>>>>
>>>>>
>>>>>In fox:
>>>>>
>>>>>cList="<select name='somename'>"
>>>>>scan
>>>>>   cList=cList+"<option value='"+cursor.yourvalue+"'>"+cursor.yourtext+CRLF
>>>>>endscan
>>>>>cList=cList+"</select>"
>>>>>
>>>>>thisform.oBrowserControl.document.frames('Content').mylist.innerHTML=cList
>>>>>
>>>>>
>>>>>
>>>>>HTH :)
>>>>>
>>>>>>Gerald,
>>>>>>
>>>>>>I think that what you're suggesting is what I'm doing. I'm not using scripts. I'm using a VFP scan loop to access the list object in the html page as follows:
>>>>>>
>>>>>>
>>>>>>scan
>>>>>>   with thisform.oBrowserControl.document.frames('Content').SomeList
>>>>>>      .options[lnCounter].Value=...
>>>>>>      .options[lnCounter].Text=...
>>>>>>   endwith
>>>>>>endscan
>>>>>>
>>>>>>
>>>>>>This is after I intercept the user's action to rebuild the list via BeforeNavigate2 method.
>>>>>>
>>>>>>I did notice some improvement with the speed after I modified the VFP code above to something like this:
>>>>>>
>>>>>>
>>>>>>olist = thisform.oBrowserControl.document.frames('Content').SomeList
>>>>>>olist.options.length = RECCOUNT('somecursor')
>>>>>>lnCounter = 0
>>>>>>
>>>>>>select somecursor
>>>>>>scan
>>>>>>   with olist.options[lnCounter]
>>>>>>      .Value=...
>>>>>>      .Text=...
>>>>>>   endwith
>>>>>>
>>>>>>   lnCounter = lnCounter + 1
>>>>>>endscan
>>>>>>
>>>>>>
>>>>>>Seems like VFP was being crippled with such a long object hierarchy. Do you see anyway to improve the speed of this code?
>>>>>>
>>>>>>Thanks again for the help.
>>>>>>
>>>>>>Mike
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>Another approach you can try if a script on the page is too slow, is to recreate the list in VFP.
>>>>>>>
>>>>>>>You can cancel the navigation in BeforeNavigate2 event and replace the list in the document directly.
>>>>>>>
>>>>>>>My 2 c
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform