[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 |
Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit |
Moderator: | STAR::VATNE |
|
Created: | Mon Oct 30 1989 |
Last Modified: | Mon Dec 31 1990 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3726 |
Total number of notes: | 19516 |
3280.0. "help with code for menubar" by GIDDAY::LIM () Wed Aug 29 1990 20:59
A customer of mine is trying to write a basic program to create a menu
bar with pulldown widgets. It sort of works but he is unable to display
the entries in the menu bar to where he wants , the only place he can
put the entry is on the left of the menu-bar (ie the origin). I don't
know anything about writing code for window. I would appreciate it
someone/s would be kind enough to point out what is wring with his
code. He is running vms 5.3-1 .
His code follows:....
option type = explicit
%include "decw.inc"
%include "xlib.inc"
%include "new_x_graph_defns.inc"
external long function widget_info
declare dwt$widget toplevel,main_window, menu_bar, pull1, menu1, &
menu1_option1, menu1_option2, menu2_option1, menu2_option2, menu2, pull2, &
text_widget, test_widget, work_window
declare byte wind_exit
! define nil_proc as the equivalent in basic as a nil pointer to a procedure.
declare dwt$void_proc nil_proc
declare dwt$arg arglist(1 to 5), push_arglist(1 to 8), arglist_init(1 to 5)
declare x$event wind_event
declare dwt$cardinal hold_value
declare dwt$callback callback_arg(1 to 2)
declare dwt$cardinal our_zero_c
declare long our_zero, our_zero(1 to 1)
declare dwt$comp_string latin, push_latin
declare dwt$strng s1
declare dwt$arg_val a1
map (wid1) dwt$widget my_widget, widg_init
declare long shell_width, shell_height, TEXT_ACROSS_WIN, text_down_win, pos_dom
declare gfloat constant len_char = 0.3
declare string accl, s2, the_string
!****************************************************************************
! Initialize toolkit
our_zero(1) = 0
our_zero_c::f(1) = 0
toplevel = xt$initialize("text window","textclass",0 ,our_zero_c,&
our_zero_c,our_zero())
call dwt$vms_set_arg(dwt$c_true,arglist(), 0, dwt$c_nallow_shell_resize)
hold_value::f(1) = 1
call xt$set_values(toplevel, arglist(), hold_value)
! Create main window
main_window = dwt$main_window( toplevel, "MAIN_WINDOW", 0, 0, 400, 400)
! Create work window
work_window = DWT$DIALOG_BOX(main_window, "MAINWIN", DWT$C_TRUE, &
0, 0, latin::f(1), DWT$C_WORKAREA,, )
! Create menu bar
menu_bar = dwt$menu_bar( main_window, "menubar", callback_arg(), )
! Create pull down menu
!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
! The problem lies somewhere around here, I believe, in that I cannot address
! the menu to anywhere, but origin of menu bar. Here I have entered 50 pixels
! as a test
!
!
menu2 = dwt$menu( menu_bar, "menu2", 50, 0, dwt$c_menu_pull_down, &
dwt$c_orientation_vertical, , , )
call dwt$latin1_string("Alans", latin)
pull2 = dwt$pull_down_menu_entry( menU_bar, "pull2", 50, 0, latin::f(1), menu2, , )
call xt$free(latin::f(1))
!
!
!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
! Create text widget
the_string = "The String"
text_widget = DWT$S_TEXT( work_window, "simptext", &
20, 20, 10, 2, the_string )
! Manage widgets
call xt$manage_child(text_widget)
call xt$manage_child(work_window)
call xt$manage_child(pull2)
call xt$manage_child(menu_bar)
call xt$manage_child(main_window)
call xt$realize_widget(toplevel)
wind_exit = 0
until wind_exit
call xt$next_event( wind_event )
call xt$dispatch_event( wind_event )
next
end program
T.R | Title | User | Personal Name | Date | Lines |
---|
3280.1 | | XANADU::GANAPATHI | | Thu Sep 06 1990 18:12 | 16 |
| From your note, I assume that your customer needs to display a bunch of entries
on the menubar which then can be pull'ed down to reveal a number of menu items.
In order to do this, you need to
a) create a pull down menu entry as a child of the menu bar ( for each entry).
b) create the pull down menu as a child of the entry (not the menu bar as your
cutomer's code shows).
c) create the menu items (as pushbuttons) to be the children of the pull down
menu.
This will do what I think your customer is trying to accomplish.
jay
|