Re: How do I fix the window size?

2012-06-06 Thread Ferdinand Ramirez
--- On Tue, 6/5/12, Chris Vine ch...@cvine.freeserve.co.uk wrote:

 Are you calling
 gtk_scrolled_window_add_with_viewport()?  If so, use
 gtk_container_add() instead, because tree views have native
 scrolling
 capabilities.

Tried out both. I'm in the process of trying out other options like using boxes 
and will let you know what works. 

-Ferdinand
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


How do I fix the window size?

2012-06-05 Thread Ferdinand Ramirez
Apologies if this has been asked before, but I searched online and could not 
find any discussion on this issue and I did not find anything on the 
documentation page.

I have a treeview and a scrollbar which are both within a hbox. The hbox is 
within a window. When I expand the treeview, the window resizes itself to 
include the whole treeview. 

The biggest problem is when the treeview has more elements than what can be 
seen on a single screen. The window size becomes larger than the display.

I want the window size to remain the same and use my scrollbar to navigate my 
treeview. How do I achieve this? gtk_window_resize does not seem to be the 
solution.

Thanks,
-Ferdinand
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How do I fix the window size?

2012-06-05 Thread James Tappin
On 5 June 2012 11:00, Ferdinand Ramirez ramirez.ferdin...@yahoo.com wrote:

 I have a treeview and a scrollbar which are both within a hbox. The hbox
 is within a window. When I expand the treeview, the window resizes itself
 to include the whole treeview.

 The biggest problem is when the treeview has more elements than what can
 be seen on a single screen. The window size becomes larger than the display.

 I want the window size to remain the same and use my scrollbar to navigate
 my treeview. How do I achieve this? gtk_window_resize does not seem to be
 the solution.


I think the solution is to place the treeview in a gtk_scrolled_window
rather than using an hbox and an explicit scrollbar. You may also need to
make a call to gtk_widget_set_size_request on the scrolled window to get
what you want.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How do I fix the window size?

2012-06-05 Thread Ferdinand Ramirez
--- On Tue, 6/5/12, James Tappin jtap...@gmail.com wrote:

 I think the solution is to place the treeview in a gtk_scrolled_window 
 rather than using an hbox and an explicit scrollbar. 

The reason for trying out with an explicit hbox is that the column headers 
scroll out of view with a gtk_scrolled_window.

-Ferdinand
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How do I fix the window size?

2012-06-05 Thread James Tappin
On 5 June 2012 12:50, Ferdinand Ramirez ramirez.ferdin...@yahoo.com wrote:

 --- On Tue, 6/5/12, James Tappin jtap...@gmail.com wrote:

  I think the solution is to place the treeview in a gtk_scrolled_window
  rather than using an hbox and an explicit scrollbar.

 The reason for trying out with an explicit hbox is that the column headers
 scroll out of view with a gtk_scrolled_window.


I'm puzzled as it doesn't do that in my RPN calculator stack and registers
display. This uses a list model (i.e. no sub-rows).  Here are the key bits
of code (in Fortran 2003 -- I'm not a C programmer).

The list creator function:

  function hl_gtk_listn_new(scroll, ncols, types, changed, data, multiple,
width, titles, height, swidth, align, ixpad, iypad, sensitive, 
tooltip, sortable, editable, colnos, edited, data_edited)
result(list)

type(c_ptr) :: list
type(c_ptr), intent(out) :: scroll
integer(kind=c_int), intent(in), optional :: ncols
integer(kind=type_kind), dimension(:), intent(in), optional :: types
 .
 .
 .
! Create the storage model
model = gtk_list_store_newv(ncols_all, c_loc(types_all))

! Create the list in the scroll box
scroll = gtk_scrolled_window_new(C_NULL_PTR, C_NULL_PTR)
call gtk_scrolled_window_set_policy(scroll, GTK_POLICY_AUTOMATIC, 
  GTK_POLICY_AUTOMATIC)
list = gtk_tree_view_new_with_model(model)
call gtk_container_add(scroll, list)
  .
  .
  .

And in the calculator itself:

  ! Registers.
  jbase = hl_gtk_box_new()
  idx = hl_gtk_notebook_add_page(mstabs, jbase, 
label=Registers//c_null_char)
  fmemory = hl_gtk_listn_new(smemory, changed=c_funloc(memsel), 
height=300, titles= (/ Index//c_null_char, Value//c_null_char
/), 
types = (/ g_type_int, g_type_double /))
  call hl_gtk_listn_set_cell_data_func(fmemory, memcol, 
func=c_funloc(show_list), data=c_loc(memcol))
  call hl_gtk_box_pack(jbase, smemory)

I hope that this will at least give some clues as to how the bits fit
together.

P.S. hl_gtk_* routines are Fortran routines that bundle settings together
and use Fortran's optional argument system to hide much of the complexity
of the raw gtk_* calls.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How do I fix the window size?

2012-06-05 Thread Chris Vine
On Tue, 5 Jun 2012 11:50:42 -0700 (PDT)
Ferdinand Ramirez ramirez.ferdin...@yahoo.com wrote:
 --- On Tue, 6/5/12, James Tappin jtap...@gmail.com wrote:
 
  I think the solution is to place the treeview in a
  gtk_scrolled_window rather than using an hbox and an explicit
  scrollbar. 
 
 The reason for trying out with an explicit hbox is that the column
 headers scroll out of view with a gtk_scrolled_window.

Are you calling gtk_scrolled_window_add_with_viewport()?  If so, use
gtk_container_add() instead, because tree views have native scrolling
capabilities.

Chris
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list