[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Trading platform + AB



PureBytes Links

Trading Reference Links

Hi scourt2000,

I have used languages that are high level and extremely good a GUI  
implementations.  They have this construct that you point out.

However, they are not actually interrupt driven, but message  
hierarchy driven.  It amounts to a giant code loop like AFL in actual  
practice.

What Herman suggests amounts to the same thing assuming we get a new  
AFL command and behaviors.

With the current GetCursorMouseButtons(), we get the static state of  
all the mouse buttons.  This is useful for certain kinds of  
interactions with the chart.  But what we need to do certain  
operations reliably is a GetCursorMouseClicks() function.  It will  
only be true for each mouse button for one pass after the mouse is  
released, and the X,Y position will be latched for the point where  
the mouse was released for that one pass.

We can sort of do that with the current functions by using static  
variables and detecting that a change has occurred in the state of  
the mouse buttons since the last pass.  However, we can move the  
mouse very fast, and AFL is slow by comparison (to me anyway).  But  
perhaps the operating system noticed where the mouse was clicked and  
can supply AB with that location. ;-)

AFL can do nothing until it runs a pass of your AFL script for a  
particular chart.  You can't just jump into the middle of a script  
because a mouse click happened on that chart and there is an ON 
(mouseLeftClick){} buried in there some where.

Since a script has to run for a chart for a pass after the mouse  
click to be recognized, one of two approaches can be used:

The first is that the chart that the mouse click is on is the only  
AFL that will detect THAT mouse click.  No additional GetCursorChartID 
()  function is required for this to fix Herman's concerns.

The second way is Herman's which was to be able to ask for the  
ChartID of the mouse click.

In either case the AFL is just as simple as your example (though a  
little more wordy).

Somewhere in the AFL you have to "specify" which mouse click and  
specify what to do about it.

On(rightMouseClick) {...}

or (Mouse clicks valid only for the AFL of the chart)

If(GetCursorMouseClick()==rightMouse) {...}

or (Mouse clicks sent to all charts for one pass

If(GetCursorMouseClick()==rightMouse AND GetCursorChartID() ==  
GetChartID()) {...}

I believe that Herman's way adds a bit more flexibility, because you  
can have a different "chart" supervising the mouse clicks and  
creating a "control panel" for another chart pane.

My 2 cents.

Best regards,
Dennis


On Jan 29, 2008, at 8:51 PM, scourt2000 wrote:

>
> "This can be done now using GetCursorMouseButtons(),
> GetCursorXPosition() and GetCursorYPosition() . HOWEVER there is no
> function that returns the ChartID for the chartpane over which the
> mouse is clicked"
>
> Hi Herman,
>
> All of that chartID stuff would not be necessary if you tied the
> mouse button clicks to well-known event routines (like that ones I
> mentioned as an example) which get called specifically from the AFL
> code behind a chart pane.
>
> You want this type of facility event-driven, not polled.  Polling
> puts more work on the user's side and brings up other unpleasant side-
> effects like what you just described.
>
> Which would you rather do?
>
> 1) Code a rats nest of polling inline with your other AFL code
>
> -or-
>
> 2) Have a well-known function called on a mouse click with all of the
> information you need provided as the function parameters directed to
> the script already bound to a particular chart pane?
>
> Anyone who chooses #1 last seriously programmed a computer more than
> 20 years ago.
>
> "That's available now - check the list of functions, duude."
>
> No it's not...duude [sic]
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
> Yahoo! Groups Links
>
>
>



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/