OnUpdateUI
NewsProductsDownloadsSupportForumCredits

TEmbeddedWB 
History 
HtmlEdit 
TIEAddress 
TIEDownload 
TIEDownloadManager 
IEGuid 
TIEParser 
Favorites 
TIESecurityManager 
IE5Tools 
TIETravelLog 
TLinksBar 
Protocols 
TRichEditWB 
TWebUpdater 
ResourceTool 
UI - lessParser 
Delphi Links 

 

 

[Home][Support][TEmbeddedWB][Events][OnUpdateUI]


OnBeforeNavigate2OnCommandStateChangeOnDocumentCompleteOnDownloadBeginOnDownloadCompleteOnFullScreenOnGetExternalOnGetHostInfoOnGetOptionKeyPathOnMenuBarOnNavigateComplete2OnNavigateErrorOnNewWindow2OnQuitOnProgressChangeOnPropertyChangeOnScriptError EventOnShowContextMenuOnShowDialogOnShowHelpOnShowMessageOnStatusBarOnStatusTextChangeOnTheaterModeEventOnTitleChangeOnToolbar EventOnTranslateAcceleratorOnTranslateUrlOnUpdateUIOnVisible

 

OnUpdateUI

 

This function is called before loading a URL  to allow you an opportunity to modify the URL.

In the following  example the user is only allowed access to local stored files. If a link to an internet-site is clicked, we want a file "DontDoThis.htm" to be shown.

 

uses comobj;

function
TForm1.EmbeddedWB1TranslateUrL(const dwTranslate: Cardinal;
const pchURLIn: PWideChar; var ppchURLOut: PWideChar): HRESULT;
begin
  if
Pos('file:///',pchURLIn) = 0 then
  ppchURLOut := StrToPLOleStr('DontDoThis.htm');
end;

Similar lines of code could also have been placed in OnBeforeNavigate2 but there is an important difference: OnTranslateUrl is not called when you use Navigate or Navigate2 but only when a hyperlink is clicked. So in this example you could still let a speedbutton call EmbeddedWb1.Go('www.somewhere.com') without  redirecting the user to "DontDoThis.htm".OnUpdateUI

 

OnUpdateUI is called when the command state is changed and it is time to update toolbar buttons, menus etc.
I always place the UI-updating stuff in  OnCommandStateChanged and have not been able to find situations where one could benefit from using OnUpdateUI instead. OnUpdateUI seems to be called more often then OnCommandStateChanged.

The following sample uses OnUpdateUI to make sure that menu-item 'Copy'  (CopyMenu) is enabled only when text has been selected.

 

function TForm1.EmbeddedWB1UpdateUI: HRESULT;
begin
CopyMenu.Enabled:=(Embeddedwb1.QueryStatusWB(OLECMDID_COPY)=OLECMDF_ENABLED or OLECMDF_SUPPORTED);

 

[Home][News][Products][Downloads][Support][Forum][Credits]

Created   by
Per Lindsų Larsen

Copyright (c) 2005 bsalsa productions. All rights reserved.

bsalsa@bsalsa.no-ip.info