Philippe Lang
2006-Oct-24 20:06 UTC
[fxruby-users] FXTreeList, single and double clicks events
Hi, When double-clicking on an item in an FXTreeList, both SEL_CLICKED and SEL_DOUBLECLICKED events are generated. @treelistframe = FXVerticalFrame.new(@group_left, FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0) @tree = FXTreeList.new(@treelistframe, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LINES| TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT) @tree.connect(SEL_CLICKED, method(:onClick)) @tree.connect(SEL_DOUBLECLICKED, method(:onDoubleClick)) def onClick(sender, sel, data) puts "click" end def onDoubleClick(sender, sel, data) puts "double-click" end Is that a feature of Fox, or a small bug maybe? Cheers, --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061024/b83b9057/attachment.bin
fxrbu1 at gi2.herzkes.de
2006-Oct-25 08:19 UTC
[fxruby-users] FXTreeList, single and double clicks events
Philippe Lang wrote:> When double-clicking on an item in an FXTreeList, > both SEL_CLICKED and SEL_DOUBLECLICKED events are generated.I believe this is common behaviour among GUI toolkits since the toolkit cannot predict the future. After the first click, it does not know if a second click will follow. T.
Jeroen van der Zijp
2006-Oct-25 23:59 UTC
[fxruby-users] FXTreeList, single and double clicks events
On Wednesday 25 October 2006 03:19, fxrbu1 at gi2.herzkes.de wrote:> Philippe Lang wrote: > > When double-clicking on an item in an FXTreeList, > > both SEL_CLICKED and SEL_DOUBLECLICKED events are generated. > > I believe this is common behaviour among GUI toolkits since the toolkit > cannot predict the future. After the first click, it does not know if a > second click will follow.Yes, that''s basically just how it is; its very hard to make a prediction, especially about the future ;-) - Jeroen -- +----------------------------------------------------------------------------+ | Copyright (C) 18:50 10/25/2006 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+
Gérard Ménochet
2006-Oct-27 21:13 UTC
[fxruby-users] FXMenuTiltle with no focus - A Workaround
Hi, For those who are interested, I think I have found a decent solution for a little problem which was a very very big concern for me. (Fox 1.6.0) The workaround does nothing with FXMenuTitle (eh oui), just SEL_FOCUSIN , SEL_UPDATE on FXMenubar and a small method - getLastObjectWithFocus() - cast an eye on this program and try it !!!! require ''fox16'' include Fox class MenuTitleWorkaround < FXMainWindow def initialize(pApp) @focus = nil super(pApp, "FXMenuTitle - Workaround", nil, nil, DECOR_ALL, 20, 20, 800, 600) menuBar = FXMenuBar.new(self, LAYOUT_SIDE_TOP | LAYOUT_FILL_X) menuBar.connect(SEL_FOCUSIN) do |sender, selector, data| if @focus != nil @focus.setFocus() @focus = nil end 0 end menuBar.connect(SEL_UPDATE) do |sender, selector, data| @focus = getLastObjectWithFocus() 0 end menuPane = FXMenuPane.new(menuBar) FXMenuCommand.new( menuPane, "&firstMenuCommand") a = FXMenuCommand.new( menuPane, "&Quit") a.connect(SEL_COMMAND) do |sender, selector, data| getApp.handle(self, MKUINT(FXApp::ID_QUIT, SEL_COMMAND), nil) end self.accelTable.addAccel(fxparseAccel("Alt+F4"), getApp(), FXSEL(SEL_COMMAND, FXApp::ID_QUIT)) FXMenuTitle.new( menuBar, "&File", nil, menuPane) menuPane = FXMenuPane.new(menuBar) FXMenuCommand.new( menuPane, "&What you want") FXMenuCommand.new( menuPane, "&Ect") FXMenuTitle.new( menuBar, "&Edit", nil, menuPane) splitter FXSplitter.new(self,LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_TRACKING|SPLITTER_V ERTICAL|SPLITTER_REVERSED) c = FXText.new(splitter, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y) c.setText("Feeding gas into centrifuges can produce fuel for nuclear power plants") d = FXText.new(splitter, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y) d.setText("The move is being seen as an act of international defiance by Teheran") d.setFocus() end def getLastObjectWithFocus(objectClass = nil) childrenArray = self.children objectWithFocusArray = [] childrenArray.each do |child| if child.hasFocus?() and (objectClass == nil or child.kind_of?(objectClass)) objectWithFocusArray << child end child.children.each do |grandChild| childrenArray << grandChild end end if objectWithFocusArray.length > 0 return objectWithFocusArray[objectWithFocusArray.length - 1 ] else return nil end end def create super show(PLACEMENT_SCREEN) end end exit if __FILE__ != $0 puts Fox.fxrubyversion() app=FXApp.new() app.threadsEnabled=false # ok app.setDefaultCursor(DEF_MOVE_CURSOR,FXCursor.new(app)) w=MenuTitleWorkaround.new(app) app.create w.show app.run see you G?rard M?nochet