473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

general function who activate callback on every object - please help

Thank you for your preveious help in the JS forum
can you help my to understand why it is still doesn't work?
I am trying to make a usefull func (ActivateFuncOnObjects3) which can
recieve a list ("obj1,obj2") and activate different func on every
object of the list

thanks

function DisableF2()
{
OBJECT(text).disabled=true;
}

function ActivateFuncOnObjects3(list,Callbackfunction)
{
return function() { Callbackfunction(text); };
}

function ActivateFuncOnObjectsFromList(list,fn)
{
var arr = list.split(',');
for(var i=0;i<arr.length;i++)
{
fn(arr[i]);
}
}

var list='obj1,obj2';
var v3 = ActivateFuncOnObjects3(list,DisableF2)
ActivateFuncOnObjectsFromList(list,v3);

Oct 26 '08 #1
1 1591
Montezuma's Daughter wrote:
Thank you for your preveious help in the JS forum
Which "JS forum" are you talking about?
function DisableF2()
{
OBJECT(text).disabled=true;
}
`DiableF2' is unused. `OBJECT' and `text' are undefined. Besides, `OBJECT'
is an identifier unwise to choose, since there is the built-in `Object'.
function ActivateFuncOnObjects3(list,Callbackfunction)
{
return function() { Callbackfunction(text); };
}
`list' is unused.

I recommend you use a source code editor that points out these errors, such
as the JavaScript Editor plugin from Eclipse's Web Development Tools:

<http://download.eclipse.org/webtools/downloads/>
var list='obj1,obj2';
Use Array objects for lists, not comma-separated strings.

Besides, identifiers should start lowercase unless they specify constructors
or constants (just code style).
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Oct 26 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
1
by: pvdm | last post by:
Hi, I am writing an app which encapsulates a multimedia timer. I implemented a TimerProc as static member function and a static member variable pThis as pseudo this variable to access in the...
2
by: Smogo | last post by:
Hi, I'm new to JavaScript so forgive me if the answer to this question is (a) ridiculously obvious, or (b) beyond the realms of JavaScript.... Is it possible to create URLs from function call...
3
by: Jan-Henrik Grobe | last post by:
Hallo, I am coming to this newsgroup with a very strange Problem. I have two c++ files A.cpp and B.cpp....In A.cpp I am creating an openGL window and in B.cpp I have stored the callback...
1
by: Henrik Pedersen | last post by:
Hi I am developing a wrapper for a C++ SDK DLL built for a video capture card. After opening all channels on the card i call the function StartVideoCapture(IntPtr channelHandle) what is supposed...
2
by: Jake Barnes | last post by:
In the function below, the reset() method has no effect. What is the correct way to ensure that singletonArrayToHoldElementsForTheNextRenderingOfTheCommunicationBox is empty? function...
17
by: Matt Kruse | last post by:
Perl's map() function is a powerful shortcut to accomplish many "loop over an array and do X" operations. Below is a quick hack to simulate similar functionality. I've used it a few times and find...
6
by: smmk25 | last post by:
Before I state the problem, I just want to let the readers know, I am knew to C++\CLI and interop so please forgive any newbie questions. I have a huge C library which I want to be able to use in...
7
by: ghulands | last post by:
I am having trouble implementing some function pointer stuff in c++ An object can register itself for many events void addEventListener(CFObject *target, CFEventHandler callback, uint8_t...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.