Skip to Content
Volume 7A: XView Programming Manual
book

Volume 7A: XView Programming Manual

by Dan Heller
October 1994
Intermediate to advanced
770 pages
22h 58m
English
O'Reilly Media, Inc.
Content preview from Volume 7A: XView Programming Manual
Example F-2. The scroll_cells2.c program (continued)
xv_set(vert_scrollbar,
SCROLLBAR_OBJECT_LENGTH, CELLS_PER_COL,
SCROLLBAR_PAGE_LENGTH, page_h,
SCROLLBAR_VIEW_LENGTH, page_h,
NULL);
}
F.3 menu_dir2.c
In Chapter 11, Menus, the program menu_dir.c demonstrates the use of an XView menu in a
canvas subwindow. A menu is brought up with the MENU mouse button and displays menu
choices representing the files in the directory. The problem with menu_dir.c is that the entire
menu cascade is created for all the subdirectories at the very beginning of the program. If the
directory stack is very deep, it could take a very long time to build. You could also run out of
memory in the process. Further, if the contents of the directory tree is dynamic, the menu
entries could become invalid over time.
These problems are solved in menu_dir2.c because it creates only the top-level menu. For
each directory entry under the top-level, rather than creating an associated pullright menu, a
MENU_GEN_PULLRIGHT procedure is specified. This routine creates that menu only at the
time it is needed. So, when the user invokes the menu and tries to descend into a submenu
representing a subdirectory in the directory tree, only then is the directory entry searched and
a new submenu created. When the user backs out of the menu, the menu is des-
troyed—attempting to re-enter the submenu causes the process to be repeated.
An exercise for
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Volume 6A: Motif Programming Manual

Volume 6A: Motif Programming Manual

David Brennan, Dan Heller, Paula Ferguson

Publisher Resources

ISBN: 9780937175873