{"id":1622,"date":"2008-03-06T11:56:36","date_gmt":"2008-03-06T11:56:36","guid":{"rendered":"http:\/\/www.amibroker.org\/userkb\/2008\/03\/06\/introduction-to-real-time-control-panels\/"},"modified":"2012-01-29T15:13:10","modified_gmt":"2012-01-29T15:13:10","slug":"introduction-to-real-time-control-panels","status":"publish","type":"post","link":"http:\/\/www.amibroker.org\/editable_userkb\/2008\/03\/06\/introduction-to-real-time-control-panels\/","title":{"rendered":"Introduction to Real-Time Control-Panels"},"content":{"rendered":"
IMPORTANT NOTES<\/strong>: <\/p>\n 1) Posts in this category are published as code is developed and you should use the most recent version posted. This code is shared without extensive field testing and may contain errors or function different than you expect. Always verify that the code does what you want it to do before using it in a real application<\/em>. This publishing method is used to give you a chance to use it at the current stage of development, else you would have to wait until all functions are completed – and that time might never come :-) <\/p>\n 2) All code on the UKB takes advantage of the latest AFL functions. If you encounter problems, and before posting questions, please verify that you are running the latest AmiBroker beta software. New releases are usually announced in the AmiBroker Development Log<\/a>. The code you find here is modified too frequently to add\/maintain version() statements to\/in all programs published.<\/p>\n 3) The code covered in this series of posts make extensive use of GFX functions please read the posts in the GFX Programming category.<\/a><\/p>\n ========== <\/p>\n In Real-Time trading it is handy to use "Control Panels". Control Panels are custom button layouts that can be used to change system settings, and give Real-Time visual feedback on the state of the system. Clicking any of the buttons lets you execute specific code with a single mouse click. While the AmiBroker Parameter window is very useful for use with Indicators it lacks important features needed in Real-Time. Posts in this category will cover the development of a custom menu system for use in Real-Time applications. It will offer: relocatable and collapsible menus, dynamic coloring, multi-state toggles, dynamic labels, sizable buttons and fonts, status indicators, unlimited menu columns, etc. Of course you can conceive and add your own special functions. The main code can be placed in an Include file and menus and buttons can be added to your code with statements somewhat similar to the AmiBroker Param(). The code below generates the first column for the test menu shown in the image below the code. <\/p>\n A Rotate button changes state with each click. It can function as a ParamToggle() but can also be used to rotate through multiple states like Buy, Sell, Short, and Cover just by clicking the button multiple times. Each click can change the Button label and color. Here is a typical menu layout:<\/p>\n \n <\/a> <\/p>\n Menus can be collapsed by Double-Clicking on any of the Blue headers. This means you can uncover hidden chart sections instantly, without having to move the menu block. In its collapsed state the menu looks like this:<\/p>\nMenu_Begin<\/span>( &<\/span>quot<\/span>;<\/span>MENUS<\/span>&<\/span>quot<\/span>;, <\/span>ButtonHeight<\/span>, <\/span>ButtonWidth<\/span>, <\/span>MenuXoffset<\/span>, <\/span>MenuYoffset <\/span>); \r<\/span>MenuMinimized <\/span>= <\/span>MenuHeader<\/span>( <\/span>BLU<\/span>, <\/span>WHT<\/span>); \r<\/span>ExpandAll <\/span>= <\/span>MenuTrigger<\/span>( &<\/span>quot<\/span>;<\/span>EXPAND ALL<\/span>&<\/span>quot<\/span>;, <\/span>ColorTrigger<\/span>, <\/span>ColorTriggerOn<\/span>, <\/span>BLK <\/span>); \r<\/span>SaveMenus <\/span>= <\/span>MenuTrigger<\/span>( &<\/span>quot<\/span>;<\/span>SAVE<\/span>&<\/span>quot<\/span>;, <\/span>ColorTrigger<\/span>, <\/span>ColorTriggerOn<\/span>, <\/span>BLK <\/span>); \r<\/span>LoadMenus <\/span>= <\/span>MenuTrigger<\/span>( &<\/span>quot<\/span>;<\/span>LOAD<\/span>&<\/span>quot<\/span>;, <\/span>ColorTrigger<\/span>, <\/span>ColorTriggerOn<\/span>, <\/span>BLK <\/span>); \r<\/span>MovingMenu <\/span>= <\/span>ButtonRotate<\/span>( &<\/span>quot<\/span>;<\/span>MOVING<\/span>,<\/span>DRAG MENU<\/span>&<\/span>quot<\/span>;, &<\/span>quot<\/span>;<\/span>4<\/span>,<\/span>1<\/span>&<\/span>quot<\/span>;, &<\/span>quot<\/span>;<\/span>7<\/span>,<\/span>2<\/span>&<\/span>quot<\/span>;); \r<\/span>Menu_End<\/span>();<\/<\/span>p<\/span>><\/span><\/pre>\n