Class: FXSearchDialogBox

Inherits:
FXDialogBox
  • Object
show all
Defined in:
lib/IFMapper/FXSearchDialogBox.rb

Overview

Class used to display a connection dialog box

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ FXSearchDialogBox

Returns a new instance of FXSearchDialogBox.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/IFMapper/FXSearchDialogBox.rb', line 22

def initialize(parent)
  decor = DECOR_TITLE|DECOR_BORDER|DECOR_CLOSE
  super( parent, '', decor, 40, 200, 0, 0 )
  @index = 0
  mainFrame = FXVerticalFrame.new(self,
		    FRAME_SUNKEN|FRAME_THICK|
		    LAYOUT_FILL_X|LAYOUT_FILL_Y)

  frame = FXHorizontalFrame.new(mainFrame, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

  FXLabel.new(frame, "Search String: ", nil, 0, LAYOUT_FILL_X)
  @search = FXTextField.new(frame, 40, nil, 0, LAYOUT_FILL_ROW)

  frame = FXHorizontalFrame.new(mainFrame, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X)
  @previous = FXButton.new(frame, "Previous Match")
  @previous.connect(SEL_COMMAND) { |sender, sel, e |
    @index -= 1 if @index > 0
    sender.handle(self, MKUINT(message, SEL_CHANGED), nil)
    @proc.call @search, nil, nil if @proc
  }
  @next     = FXButton.new(frame, "Next Match") 
  @next.connect(SEL_COMMAND) { |sender, sel, e |
    @index += 1
    @proc.call @search, nil, nil if @proc
  }

  # We need to create the dialog box first, so we can use select text.
  create
end

Instance Attribute Details

#indexObject

Returns the value of attribute index.



6
7
8
# File 'lib/IFMapper/FXSearchDialogBox.rb', line 6

def index
  @index
end

Instance Method Details

#proc=(p) ⇒ Object



17
18
19
20
# File 'lib/IFMapper/FXSearchDialogBox.rb', line 17

def proc=(p)
  @search.connect(SEL_CHANGED, p)
  @proc = p
end

#textObject



13
14
15
# File 'lib/IFMapper/FXSearchDialogBox.rb', line 13

def text
  return @search.text
end

#text=(x) ⇒ Object



8
9
10
11
# File 'lib/IFMapper/FXSearchDialogBox.rb', line 8

def text=(x)
  @search.text = x
  @index = 0
end