10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Event-based <strong>Programming</strong>The following sample frame script is the Click event block for the Graphicoperation on the View menu. This menu operation functions as a toggle fieldthat lets the user turn on or turn off the display of the photograph associatedwith a given video.on click menu.view_menu.show_graphic =beginif menu.view_menu.show_graphic = FALSE thengraphic_frame.Terminate();graphic_frame = null;elsegraphic_frame = openframevideo_graphic(vid_graphic_bitmap =video.vid_graphic_bitmapobject)with windowtitle = video.title,windowxleft = CurFrame.WindowWidth,windowytop = 0;endif;Show_video_graphic = menu.view_menu.show_graphic;endBased on user interaction, this block of code either terminates the graphicframe and reinitializes its FrameExec pointer to null, or opens it with theappropriate photograph and window location.The difference between the Click event and the SetValue event is meaningfulfor the menu list, as follows:• The Click event is triggered when the user clicks any list item, even thecurrently highlighted list item.• The SetValue event is triggered only when the user actually changes thevalue of the field.For example, assume there is a frame with a Get menu that contains a menulist called initial_acct, which offers the following choices:• New Account• Existing Account• All Accounts• Closed AccountsBecause the user might need to repeat the command, New Account, the eventblock for this menu list uses the Click event. If SetValue were used, nothingwould happen the second time the user clicked New Account.The Click, Validate, and SetValue events create an event chain in this order formenu toggles and menu lists.Managing Event Queues 327

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!