I am a big fan of tree_item and Tree_item is one of the most powerful controls provided by magik language. I can't imagine many Office applications with out a tree_item (very few without a tree_item)
From few days I am trying to develop a Yahoo messenger kind of application in magik using tcp/ip communication.
One of my requirements is to show details on mouse over on the list available. But I think the tree_item doesn’t have mouse over functionality added (at least in my scope of knowledge). I spend couple of minutes to provide a customized behavior like mouse over action to tree_item
Here is the way to add the mouse over behavior to tree_item:
(These changes are to tree_agent.magik didnt tried subclassing it)
1. add a pseudo slot say mouse_over_func and define the slot access to writeable
2. add the mouse_over_func to exported_notifiers and notifier_for_action
3. initilise the handler in init() of agent as below
.mouse_over_func << handler.new(_self, :default_mouse_over|()|)
4. enable the events for the tree in window.enable_event(:move)
5. in default_handle_event(), notify to the desired method as below
_if l_id _is :move
_then
_return _self.notify(:mouse_over_func, l_row, l_row_index, p_event)
_endif
6.
_pragma(classify_level=advanced)
_private _method tree_agent.mouse_over_func << p_new
##
##
.mouse_over_func << handler.new(_self, :default_mouse_over|()|)
>> .mouse_over_func
_endmethod
$
7.
method tree_agent.default_mouse_over(p_tree, l_row_index, p_event)
##
##
#write(p_tree, l_row_index, p_event)
_local l_sel_column << _self.column_at(p_event.x)
#do some thing
write(l_sel_column)
_if l_sel_column _is _unset
_then
_return
_endif
_endmethod
$
I just tried this code and I haven’t tested fully… but this is working. I added my custom method in the class as we do for select notifier or double click notifier.. it is working with few tracebacks.. Those are to be handled in tree_agent. default_mouse_over()
The application of GIS technology is limited only by the imagination of those who use it.
Sunday, November 8, 2009
Friday, November 6, 2009
sw_narrator
“SW Narrator” is a simple application which reads any action performed on smallworld application. it is as simple as Narrator provided by default in windows operating system. This is developed in magik by using SAPI.
Interestingly heart of the application is only 2 lines
MagikSF> v << ole_client.create_object("sapi.spvoice")
$
MagikSF> v.Speak("smallworld")
Sw narrator gets every action performed by application by add_filter_event to :interaction_mode_event. This will give handle to action and there it retrieves the UI value.
Code written in click_monitor in development tool serves the purpose.
Looking for some online drive to upload the module… I will update once I shared the module.
Interestingly heart of the application is only 2 lines
MagikSF> v << ole_client.create_object("sapi.spvoice")
$
MagikSF> v.Speak("smallworld")
Sw narrator gets every action performed by application by add_filter_event to :interaction_mode_event. This will give handle to action and there it retrieves the UI value.
Code written in click_monitor in development tool serves the purpose.
Looking for some online drive to upload the module… I will update once I shared the module.
Thursday, November 5, 2009
Draw 3D pie diagram in Excel from magik
This piece of code will help to draw a 3d pie diagram in excel sheet from magik..
_block
e << OLE_Client.Create_Object("Excel.Application")
w << e.Workbooks()
w.add()
s << e.Sheets("Sheet1")
s.Name << "bhimu"
_for i _over range (1,10)
_loop
Cell << S.Range ("A"+i.print_string)
Cell.Value << i
Cell.Release_Object ()
Cell << S.Range ("B"+i.print_string)
Cell.Value << "=A"+i.print_string+"*"+"A"+i.print_string
Cell.Release_Object ()
_endloop
s.range("A1:B10").select
c << e.charts.add
c.ChartType << :|xl3DPieExploded|
e.ActiveChart.Location(:|xlLocationAsObject|, "bhimu")
e.Visible << _True
_endblock
if location is not specified, then the chart is added to a new sheet.
init()
I started this blog from the inspiration I gained from sworldwatch, thanks to Alfred Sawatzky.
I have almost 3 years of experience in magik. I tried different applications in magik. Still i am in learning phase, but liked to post some intresing stuff I found while learing.
I am starting my first post with GIS/Geospatial Industry Worldwide and their positions. Smallworld is in 3rd position with around 8% GIS market share and around 24% Utilities share. (data collected from daratech)
http://daratech.com/press/releases/2009/091908.html
I have almost 3 years of experience in magik. I tried different applications in magik. Still i am in learning phase, but liked to post some intresing stuff I found while learing.
I am starting my first post with GIS/Geospatial Industry Worldwide and their positions. Smallworld is in 3rd position with around 8% GIS market share and around 24% Utilities share. (data collected from daratech)
http://daratech.com/press/releases/2009/091908.html
Subscribe to:
Posts (Atom)