I checked a few other things.
In my loading html document, I've got the following line in the body
section to add history support:
<iframe src="javascript:''" id="__gwt_historyFrame"
style="position:absolute;width:0;height:0;border:0"></iframe>
Is this the correct location to have this?
I also just noticed that HistoryListener was depreciated, so I updated
to ValueChangeHandler. My main section is, for the most part:
public class entry implements EntryPoint, ValueChangeHandler {
public onModuleLoad() {
RootPanel.get().add(new MenuObject());
String initToken = History.getToken();
if(initToken.length() > 0) {
onHistoryChanged(initToken);
} else {
onHistoryChanged("Home");
}
History.addValueChangeHandler(this);
}
public void onValueChange(ValueChangeEvent event) {
onHistoryChanged((String) event.getValue());
}
public void onHistoryChanged(String token) {
Window.alert("Testing " + token);
}
}
When the page loads, a window appears alerting me to the name of the
token being loaded. This also occurs while refreshing. However with
the MenuBar that is displayed, the choice changes the token in the
URL, however no window appears. If I select Reload in my browser, the
page loads and the window appears.
I've gone back and looked at the previous tutorials I was using for
reference, but it appears that I've got everything. I could not find
anything in the Showcase example - it looks like I've got everything.
I'm using Chrome 4.0.302.3 dev, as well as Firefox 3.6 for testing.
By chance is there something that I'm missing?
On Jan 30, 2:31 am, Michael Mullen <[email protected]> wrote:
> I was unable to find a solution in the discussion group, and I've been
> unable to find a solution on my own. I probably missed something and
> apologize ahead of time for draining someone's time.
>
> Here is some code in question:
> ...
> public class entry implements EntryPoint, HistoryListener {
> public onModuleLoad() {
> RootPanel.get().add(new MenuObject());
> History.addHistoryListener(this);
> }
> public void onHistoryChanged(String token) {
> Window.alert("Testing " + token);
> }
> ...
>
> }
>
> ------- New Class -------
> public class MenuObject extends MenuBar implements Command {
> public MenuObject() {
> super();
> this.addItem(new MenuItem("Test", new Command() {
> public void execute() {
> History.newItem("Test");
> }
> ));
> this.addItem(new MenuItem("Test1", new Command() {
> public void execute() {
> History.newItem("Test1");
> }
> ));
> }
>
> }
>
> In this case, I've found that the selection of any MenuItem in my
> custom MenuBar will not cause a change history event to occur. If I
> were to place a complete MenuBar object in my entry point (not
> separated into a different class), the change history event will
> occur.
>
> At the same time, the history token updates in either case. There are
> no problems with the tokens in my browsers.
>
> Is there anything that you guys could recommend to get history changes
> by the external MenuBar class to trigger the history change event?
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.