Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IExplorerObject disable input
Message
De
28/03/2008 12:59:24
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
28/03/2008 11:52:40
Mike Sue-Ping
Cambridge, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Database:
Visual FoxPro
Divers
Thread ID:
01305495
Message ID:
01306558
Vues:
7
>>This.oRules is a collection.
>
>Pardon my ignorance here, but a collection of what? I've included a modified code sample that tried to incorporate your method but it bombs on that oRules collection.

You need to add it somewhere - I've put it below as another ADD OBJECT.

And it's initially a collection of nothing, an empty bag. First time you try to set fontsizes, it records the initial fontsizes (each oRule empty object is such a record) for styles in use, and stores them in this collection. I keep initial fontsizes because the idea is to always have that fontsize times some factor, not last fontsize times a factor - to avoid rounding errors (and I'm still not sure I got it to work the way I wanted - this piece was pushed to back burner months ago). The oRule.nSize is not it yet, it's just the current size expressed numerically with available precision (and .csize is what webpage will currently use, with rounding). You can imagine that if you go with steps of 10% and stick with integer font sizes, when you come down to sizes of 6px and want to go up, 10% of it will step up to 6.6=> 7px and then to 7.7=> 8px - which is a 33% step up in two steps, while 6*1.1*1.1=7.26, i.e. it should have stayed at 7 the second time.

>
>PUBLIC oForm
>oForm = CREATEOBJECT('form1')
>oForm.SHOW()
>
>DEFINE CLASS form1 AS FORM
>	TOP = 0
>	LEFT = 0
>	HEIGHT = 530
>	WIDTH = 800
>	CAPTION = "HTML sample"
>	NAME = "Form1"
>	browserfontsize = 1
*-- here:
	add object oRules as collection

>	ADD OBJECT cmdGrow AS COMMANDBUTTON WITH ;
>		TOP = 0, ;
>		LEFT = 0, ;
>		width = 20, ;
>		CAPTION = "A"
>
>	ADD OBJECT cmdShrink AS COMMANDBUTTON WITH ;
>		TOP = 0, ;
>		LEFT = 30, ;
>		width = 20, ;
>		CAPTION = "a"
>
>	PROCEDURE cmdGrow.Click
>		thisform.BrowserSetFontSize(1.1)
>	ENDPROC
>
>	PROCEDURE cmdShrink.Click
>		thisform.BrowserSetFontSize(0.9)
>	ENDPROC
>
>	ADD OBJECT htmlviewer AS OLECONTROL WITH ;
>		TOP = 30, ;
>		LEFT = 0, ;
>		HEIGHT = 500, ;
>		WIDTH = 800, ;
>		VISIBLE = .T., ;
>		NAME = "HTMLViewer", ;
>		OLECLASS = 'Shell.Explorer.2'
>
>	PROCEDURE INIT
>		WITH THISFORM.htmlviewer
>			.Navigate2('http://levelextreme.com')
>			DO WHILE .ReadyState # 4 && Wait for ready state
>			ENDDO
>		ENDWITH
>	ENDPROC
>
>	PROCEDURE BrowserSetFontSize(tnSize)
>		*-- dn 06/03/2007
>		LOCAL loBrowser AS "Shell.Explorer.2"
>		loBrowser=THIS.htmlviewer
>		loDoc=loBrowser.DOCUMENT
>
>		FOR EACH loStyle IN loDoc.stylesheets
>			FOR i=0 TO loStyle.rules.LENGTH-1
>				loRule=loStyle.rules(i)
>				loRuleStyle=loRule.STYLE
>				lcTag=loRule.selectorText
>				IF EMPTY(THIS.oRules.GETKEY(lcTag))
>					oRule=CREATEOBJECT("empty")
>					ADDPROPERTY(oRule, "cSize", EVL(loRuleStyle.FONTSIZE, "10px"))
>					ADDPROPERTY(oRule, "nSize", VAL(oRule.cSize))
>					ADDPROPERTY(oRule, "cUnits", CHRTRAN(oRule.cSize,"0123456789.",""))
>					THIS.oRules.ADD(oRule, lcTag)
>				ELSE
>					oRule=THIS.oRules.ITEM(lcTag)
>				ENDIF
>				oRule.nSize=oRule.nSize* tnSize
>				THIS.browserfontsize=oRule.nSize
>				IF NOT oRule.cUnits = "%"
>					lcSize=ALLTRIM(TRANSFORM(oRule.nSize,"99999.99"))+oRule.cUnits
>					loRuleStyle.FONTSIZE=lcSize
>				ENDIF
>			ENDFOR
>		ENDFOR
>	ENDPROC
>ENDDEFINE
>
>

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform