Help with FXWizard panels

I’m trying to set up an installation wizard, which has just 3 steps.
However, I’m stuck with moving between panels. I understand that
setCurrentPanel can be used to change the present panel, but when I just
try to move it from 0 to 1, it raises an IndexOutOfBound. I’ve been all
over the Internet, but can’t find an example of FXWizard anywhere, only
documentation. It would be great if someone could point me in the right
direction.

class InstallationWizard < FXWizard

def initialize(app)
super(app, “Install Sync”, nil, :width => 500, :height => 500)

if self.currentPanel == 0
  hFrame1 = FXHorizontalFrame.new(self.getContainer())
    servLabel = FXLabel.new(hFrame1, "Server IP:")
    servTextField = FXTextField.new(hFrame1, 10)
    servButton = FXButton.new(hFrame1, "Connect!")

    servButton.connect(SEL_COMMAND) do
      serv = servTextField.text
      servTextField.text = nil
      getApp().reg().writeStringEntry("USER_DATA", "server", serv)

      message = FXMessageBox.information(self, MBOX_OK, "Sync",

“Server: #{serv} on #{Mac.addr}”)
end
elsif self.currentPanel == 1
hFrame1 = FXHorizontalFrame.new(self.getContainer())
usrLabel = FXLabel.new(hFrame1, “Username:”)
usrTextField = FXTextField.new(hFrame1, 4)

    pwdLabel = FXLabel.new(hFrame1, "Password:")
    pwdTextField = FXTextField.new(hFrame1, 4)
    pwdTextField.textStyle = FXTextField::TEXTFIELD_PASSWD
    pwdTextField.tipText = "Enter your password!"

    vFrame1 = FXVerticalFrame.new(self.getContainer())

    hFrame3 = FXHorizontalFrame.new(vFrame1)
    loginButton = FXButton.new(hFrame3, "Login!")

    loginButton.connect(SEL_COMMAND) do
      username = usrTextField.text
      password = pwdTextField.text
      usrTextField.text = nil
      pwdTextField.text = nil
      getApp().reg().writeStringEntry("USER_DATA", "username",

username)
getApp().reg().writeStringEntry(“USER_DATA”, “password”,
password)

      message = FXMessageBox.information(self, MBOX_OK, "Sync",

“Username: #{username}, Password: #{password}”)
end
elsif self.currentPanel == 2
hFrame2 = FXHorizontalFrame.new(self.getContainer())
showButton = FXButton.new(hFrame2, “Show!”)
showButton.connect(SEL_COMMAND) do
puts getApp().reg().readStringEntry(“USER_SELECTION”, “home”)
puts getApp().reg().readStringEntry(“USER_DATA”, “username”)
puts getApp().reg().readStringEntry(“USER_DATA”, “password”)
puts getApp().reg().readStringEntry(“USER_DATA”, “server”)
end
end

self.advanceButton.connect(SEL_COMMAND) do
  self.currentPanel = self.currentPanel + 1
end

self.cancelButton.connect(SEL_COMMAND) do
  getApp().exit(0)
end

self.finishButton.connect(SEL_COMMAND) do
  getApp().exit(0)
end

end

def create
super
show(PLACEMENT_SCREEN)
end

end

Hello. I don’t have time to read your code, sorry. What I’m going to
suggest is build your own “wizard”. FXWizard is just a conjunction of
other widgets, so you can build it by your own. I’ve been working a lot
with FXRuby a year ago and used almost all classes of FXRuby but never
FXWizard, because I’ve found what I told, it is just a conjunction of
other widgets, like FXWindow, FXImage, FXButton, FXTextField and so
on…
I’ve found some bugs too, and most of them were fixed by Lars Kanis,
current maintainer, and others no. That’s because Lars is on charge of
many projects. So, if you found a bug, report it, talk of it on FXRuby
mail list(which exists, you just have to look out) and move forward with
a workaround, i.e.: with the suggestion I made.
Cheers.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs