Hi,
This is for my son Ding Wen learning GS programming. He is now quite
good in event driven programming and wanted to learn desktop
programming. I think it is probably too hard for him to learn so I
think maybe the simplest way to solve his curiosity is not to teach
him all those window, etc, but to create a simple menu bar with some
simple menus, and when click, do a simple functions like Quit, Clear
Screen that does not involved any windows.
What's the simplest way to create menu bar and menus in Pascal? Is
pointer or handles involved in these (I try to avoid these if
possible).
Thanks!
|
|
0
|
|
|
|
Reply
|
limtc
|
6/1/2008 4:00:07 AM |
|
Just a note: I am now reading up Toolbox References... but I have
never done a desktop program for Apple IIGS before. It looks pretty
complicated to me. So if someone think we can make this looks simple
to a young programmer, appreciate the feedback.
|
|
0
|
|
|
|
Reply
|
limtc
|
6/1/2008 4:08:08 AM
|
|
A kind gentleman sent me this piece of codes, which I still think
looks a little complicated (especially when pointer is involved, many
tools are loaded, and grafport is set - But can these be avoided if
all we want is the menubar/menu and nothing else?).
program Quit;
uses Common, QuickDrawII, EventMgr, WindowMgr, ControlMgr, DeskMgr,
DialogMgr, MenuMgr;
const
return = 13; {return key code}
File_Quit = 256; {Menu ID #s}
type
long = record {for splitting 4 bytes to 2
bytes}
case boolean of
true : (long: longint);
false: (lsw,msw: integer);
end;
var
done: boolean; {tells if the program should
stop}
myEvent: eventRecord; {last event returned in event
loop}
menuNum,menuItemNum: integer; {menu number & menu item
number}
where: integer; {where the mouse event
occurred}
wPtr: grafPortPtr; {window where event occurred}
procedure InitMenus;
{ Initialize the menu bar. }
var
height: integer; {height of the largest menu}
menuHand: menuHandle; {for 'handling' windows}
s: textPtr; {for building menus}
begin {InitMenus}
new(s); {create the file menu}
s^ := concat('>> File \N1',chr(return));
s^ := concat(s^,'--Quit\N256',chr(return));
s^ := concat(s^,'.',chr(return));
menuHand := NewMenu(s);
InsertMenu(menuHand,0);
height := FixMenuBar; {draw the completed menu bar}
DrawMenuBar;
end; {InitMenus}
procedure HandleMenu;
{ Handle a menu selection. }
begin {HandleMenu}
case menuItemNum of {go handle the menu}
file_Quit: done := true;
otherwise: ;
end; {case}
HiliteMenu(false, menuNum); {unhighlight the menu}
end; {HandleMenu}
begin {Quit}
StartDesk(640);
InitMenus; {set up the menu bar}
InitCursor; {show the cursor}
done := false; {main event loop}
repeat
if GetNextEvent(everyEvent, myEvent) then
if myEvent.eventWhat = mouseDownEvt then begin
with myEvent.eventWhere do
where := FindWindow(wPtr, h, v);
if where = wInMenuBar then begin
MenuSelect(myEvent, nil);
menuNum := long(myEvent.taskData).msw;
menuItemNum := long(myEvent.taskData).lsw;
if menuItemNum <> 0 then
HandleMenu;
end; {if}
end; {if}
until done;
EndDesk;
end.
|
|
0
|
|
|
|
Reply
|
limtc
|
6/1/2008 4:20:58 AM
|
|
What would be interesting for you is find and buy the Programmer's
introduction to the Apple IIgs by Apple (ISBN 0-201-17745-5)
Another interesting book is Toolbox programming in Pascal:
http://store.syndicomm.com/index.php?main_page=product_info&cPath=4&products_id=196
Regards,
antoine
|
|
0
|
|
|
|
Reply
|
Toinet
|
6/1/2008 10:14:58 AM
|
|
I think they are a little too complex... I am trying to see whether it
is possible to simplify it to such a way that we can at least do a
menu bar without the complexity. Well you know, I am trying to teach
an 8 years old.
On 6=D4=C21=C8=D5, =CF=C2=CE=E76=CA=B114=B7=D6, Toinet <antoine.vig...@lapos=
te.net> wrote:
> What would be interesting for you is find and buy the Programmer's
> introduction to the Apple IIgs by Apple (ISBN 0-201-17745-5)
>
> Another interesting book is Toolbox programming in Pascal:http://store.syn=
dicomm.com/index.php?main_page=3Dproduct_info&cPath=3D4&p...
>
> Regards,
>
> antoine
|
|
0
|
|
|
|
Reply
|
limtc
|
6/6/2008 4:10:33 PM
|
|
|
4 Replies
782 Views
(page loaded in 0.115 seconds)
Similiar Articles: Creating simple menu in Pascal - comp.sys.apple2.programmer ...Hi, This is for my son Ding Wen learning GS programming. He is now quite good in event driven programming and wanted to learn desktop programming. I ... creating a button on a figure to stop the program. - comp.soft-sys ...Creating simple menu in Pascal - comp.sys.apple2.programmer ... creating a button on a figure to stop the program. - comp.soft-sys ... Creating simple menu in Pascal ... Idea: Applesoft & BG music - comp.sys.apple2.programmerCreating simple menu in Pascal - comp.sys.apple2.programmer ... Idea: Applesoft & BG music - comp.sys.apple2.programmer Creating simple menu in Pascal - comp.sys.apple2 ... Plugin for reading Corel Draw Files? - comp.graphics.apps.gimp ...Creating simple menu in Pascal - comp.sys.apple2.programmer ... Just a note: I am now reading up Toolbox References... but ... 13; {return key code} File_Quit ... but I ... carriage return - Chr(13) & Chr(10) - comp.databases.mysql ...Creating simple menu in Pascal - comp.sys.apple2.programmer ..... ControlMgr, DeskMgr, DialogMgr, MenuMgr; const return = 13; {return ... create the file menu} s ... translations of creat() and write() to ISO C - comp.unix ...Creating simple menu in Pascal - comp.sys.apple2.programmer ... translations of creat() and write() to ISO C - comp.unix ... NPL --=20 "It is impossible to make anything ... Closing a database - comp.databases.mysql... world of MySQL and thus I have what I expect is a simple ... the "use" command is more like "Assign" in Pascal: it ... I am using a treeview type menu system on an Access ... input & output in assembly - comp.lang.asm.x86Select the "Interrupt Services" menu option... 4. ... Another possibility, for example, is to use Pascal-like ... learn which registers you must save, learn how to create and ... FAQ -- assembly-language/x86/general/part1 - comp.lang.asm.x86 ...A simple URL in the body of your message is more ... Although programmers tend to use C, C++ or Pascal these ... manager, extended, xms, ems, conventional menu ... Where did Fortran go? - comp.lang.fortranI think the reason why Matlab is more popular is simple ... When Borland produced Turbo Pascal in 1985 ?, then Turbo ... <http://www.gino-graphics.com/products/menu.html> I ... Creating simple menu in Pascal - comp.sys.apple2.programmer ...Hi, This is for my son Ding Wen learning GS programming. He is now quite good in event driven programming and wanted to learn desktop programming. I ... Designing simple menu in pascal. - Pascal - Forums at ...Designing simple menu in pascal.: I am a newbie in pascal. I'm going to write a procedure that can convert the text inputted into the menu. ChooseOption(' Yes No ... 7/21/2012 7:46:01 PM
|