Development :  K-Meleon Forum
K-Meleon development related discussions. 
New Event Based Commands
Posted by: jsnj
Date: January 18, 2003 03:29PM

Where do you place these new event based commands within a macro? I'm tryin to get KM to open in fullscreen at startup and can't get it to work.

Options: ReplyQuote
Re: New Event Based Commands
Posted by: asmpgmr
Date: January 18, 2003 10:13PM

You have to create a macro named OnInit and that will be automatically called at startup. Likewise the macro OnQuit will be automatically called at exit.

Options: ReplyQuote
Re: New Event Based Commands
Posted by: asmpgmr
Date: January 18, 2003 10:34PM

A new macros.dll was posted, in the new version the event macro names are now OnStartup, OnQuit, OnOpenWindow, and OnCloseWindow. Note macros.dll is still a debug build.

Options: ReplyQuote
Re: New Event Based Commands
Posted by: po
Date: January 21, 2003 11:24AM

This is an example of another use for the OnStartup macros - to syncronize the state of any toggled buttons with the current state of any prefs they alter... in this case a button to toggle javascript on/off:

-------------------------------------------------------------------------------
OnStartup {
&buttonSync;
}

buttonSync {
getpref(BOOL, "javascript.enabled") ? pluginmsg(toolbars, "CheckButton", "Tool Bar, macros(jsToggle), 1") : pluginmsg(toolbars, "CheckButton", "Tool Bar, macros(jsToggle), 0");
}

# the above should be all one line!

jsToggle {
$tmp = (getpref(BOOL, "javascript.enabled") ? false : true);
setpref(BOOL, "javascript.enabled", $tmp);
statusbar("Java script " . ($tmp ? "enabled" : "disabled"));
&buttonSync;
}
----------------------------------------------------

and in toolbars.cfg, a button to fire the jsToggle macro:

JS {
macros(jsToggle)
Toggle Javascript
toolhot.bmp[11]
toolcold.bmp[11]
tooldead.bmp[11]
}

and k-meleon will now display the correct checked/unchecked state on the button when you start it up... yay! thanks for implementing this feature, developer folks. smiling smiley

Options: ReplyQuote


K-Meleon forum is powered by Phorum.