# FXTable: how to prevent a particular column from being resized?

**URL:** <https://www.ruby-forum.com/t/fxtable-how-to-prevent-a-particular-column-from-being-resized/116649>\
**Category:** FXRuby\
**Created:** [October 8, 2007, 1:52pm UTC](https://www.ruby-forum.com/t/fxtable-how-to-prevent-a-particular-column-from-being-resized/116649 "2007-10-08T13:52:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 8, 2007, 1:52pm UTC](https://www.ruby-forum.com/t/fxtable-how-to-prevent-a-particular-column-from-being-resized/116649/1 "2007-10-08T13:52:59Z")

</div>

Hi again,

I’m using FXTables with a few hidden columns, which have 0 width.

Is there a way to prevent the user from resizing these columns, which  
only have an internal meaning?

Philippe

---

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 8, 2007, 3:27pm UTC](https://www.ruby-forum.com/t/fxtable-how-to-prevent-a-particular-column-from-being-resized/116649/2 "2007-10-08T15:27:04Z")

</div>

On Monday 08 October 2007 06:51, Philippe L. wrote:

> Hi again,
> 
> I’m using FXTables with a few hidden columns, which have 0 width.
> 
> Is there a way to prevent the user from resizing these columns, which  
> only have an internal meaning?

You can disable resizing of rows and/or columns. However, its an  
all-or-nothing  
thing; you can’t turn resizing off for a single row/column only.

I can suggest a sneaky trick, maybe:- as the cursor moves, enable or  
disable  
the resizability based on the column its hovering over. I admit its not  
super elegant but it might work…

- Jeroen

–  
±---------------------------------------------------------------------------+  
| Copyright © 07:40 10/ 8/2007 Jeroen van der Zijp. All Rights Reserved. |  
±---------------------------------------------------------------------------+

---

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 9, 2007, 8:16am UTC](https://www.ruby-forum.com/t/fxtable-how-to-prevent-a-particular-column-from-being-resized/116649/3 "2007-10-09T08:16:18Z")

</div>

Jeroen van der Zijp wrote:

> row/column only.
> 
> I can suggest a sneaky trick, maybe:- as the cursor moves, enable or  
> disable the resizability based on the column its hovering over. I  
> admit its not super elegant but it might work…

I found a very useful workaround: put the zero-width columns at the  
extreme left of the FXTable. They cannot be resized there!

Philippe

---

<div class="post-metadata">

**Author:** ![philpraxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@philpraxis](https://www.ruby-forum.com/u/philpraxis)\
**Post date:** [October 9, 2007, 9:13am UTC](https://www.ruby-forum.com/t/fxtable-how-to-prevent-a-particular-column-from-being-resized/116649/4 "2007-10-09T09:13:47Z")

</div>

Jeroen van der Zijp wrote:

> row/column only.
> 
> I can suggest a sneaky trick, maybe:- as the cursor moves, enable or  
> disable the resizability based on the column its hovering over. I  
> admit its not super elegant but it might work…

Hi again,

I think I found a bug while playing with zero-width columns: as soon as  
the extreme right column is shrinked to zero width, it cannot be  
stretched anymore: when getting to the place where the stretch should  
start, the mouse icon is correct, but after the clic, nothing happens.

## My configuration:

Windows XP  
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]  
fxruby 1.6.11

## Test code:

#!/usr/bin/ruby

require ‘fox16’

include Fox

class MyWindow \< FXMainWindow

def initialize(app)

```
super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 600, 350)

# Menu bar stretched along the top of the main window
menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

# File menu
filemenu = FXMenuPane.new(self)
FXMenuTitle.new(menubar, "&File", nil, filemenu)
FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application",
    nil, app, FXApp::ID_QUIT)

# Table
f = FXHorizontalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
t = FXTable.new(f, nil, 0,

```

TABLE\_COL\_SIZABLE|LAYOUT\_FILL\_X|LAYOUT\_FILL\_Y)

```
t.visibleRows = 3
t.visibleColumns = 3
t.setTableSize(3, 3)

```

end

def create  
super  
show(PLACEMENT\_SCREEN)  
end

end

if **FILE** == $0  
application = FXApp.new(“Attik System”, “FXRuby Test”)  
MyWindow.new(application)  
application.create  
application.run  
end
