473,944 Members | 26,186 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

New Widget

THIS WIDGET RUNS CORRECTLY IN OPERA. Nothing else. (See previous
post.)

I've invented a new widget that I've named "clicker." It's like a
slider, but it hops immediately to the spot clicked. (See code
comments for how I stumbled into this.) It's here:

http://www.martinrinehart.com/examples/clicker.html

Constructive peer review of the code is most welcome.

Issues:
How to run in the other <canvas>-supporting browsers: Chrome, Firefox,
Safari
How to handle focus
How to position tic labels (how wide is "255"?)

Suggestions appreciated.
Oct 24 '08 #1
5 1360
<Ma************ @gmail.comwrote in message
news:35******** *************** ***********@m32 g2000hsf.google groups.com...
THIS WIDGET RUNS CORRECTLY IN OPERA. Nothing else. (See previous
post.)

I've invented a new widget that I've named "clicker." It's like a
slider, but it hops immediately to the spot clicked. (See code
comments for how I stumbled into this.) It's here:

http://www.martinrinehart.com/examples/clicker.html

Constructive peer review of the code is most welcome.

Issues:
How to run in the other <canvas>-supporting browsers: Chrome, Firefox,
Safari
How to handle focus
How to position tic labels (how wide is "255"?)

Suggestions appreciated.
Works on Google Chrome except for cursor key strokes.

I would remove the pop up dialog, (its annoying ;)

Regards,

Aaron
Oct 25 '08 #2
Aaron Gray wrote:
I would remove the pop up dialog, (its annoying ;)
Yup. Debugging stuff. Gone.
Oct 26 '08 #3
Aaron Gray wrote:
Works on Google Chrome except for cursor key strokes.
Really? I don't get mouse wheel in Chrome.
I would remove the pop up dialog, (its annoying ;)
Agreed. Done. (That was debugging stuff.)

Martin
Oct 26 '08 #4
Aaron Gray wrote:
Works on Google Chrome except for cursor key strokes.
Really? I don't get mouse wheel.
I would remove the pop up dialog, (its annoying ;)
Done.

Oct 26 '08 #5
On Oct 24, 1:38*pm, MartinRineh...@ gmail.com wrote:
THIS WIDGET RUNS CORRECTLY IN OPERA. Nothing else. (See previous
post.)
Yeah, I saw that one and its follow-up. Didn't know what to make of
it.
>
I've invented a new widget that I've named "clicker." It's like a
slider, but it hops immediately to the spot clicked. (See code
comments for how I stumbled into this.) It's here:
I hate to burst your bubble, but many sliders do that.
>
http://www.martinrinehart.com/examples/clicker.html

Constructive peer review of the code is most welcome.
I'm not holding out much hope here. The initial disclaimer is pretty
scary.

<body onload=init()>

Well, that is a good idea (but you need quotes around the attribute
value.) I have come to think that is a better idea than window.onload
(if you are writing a script for your own page.) I prefer to keep all
other script out of the markup (for the usual raasons), but that one
extra attribute hurts nothing and avoids the unneeded use of a non-
standard host object method.
>
Issues:
How to run in the other <canvas>-supporting browsers: Chrome, Firefox,
Safari
That's a pretty open-ended question.
How to handle focus
Focus of what?
How to position tic labels (how wide is "255"?)
What have you tried?
>
Suggestions appreciated.
Looking at a sample listener:

function click() {
var evt = window.event;
x_ = evt.pageX - clicker.left_;
clicker.repaint ( x_ );
clicker.compute ValueAt( x_ );
} // end of click()

You have made a simple mistake. The event property of the window
object is not standard. By coincidence, according to your claims, it
appears that Opera supports it to mimic IE. It likely does this so
that browser sniffing scripts will not exclude its users from rich
content that it is perfectly capable of rendering.

This listener should start like:

function click(evt) {
evt = evt || window.event;

Then you need a function that will return the mouse position relative
to some coordinates that are meaningful to your widget. I think there
is an example in the FAQ or FAQ notes that retrieves the document
coordinates. Certainly evt.pageX alone is insufficient.

Unfortunately, here you needed to make use of "unobtrusiv e
javascript."

<canvas id=clicker1 class=clicker
width=200 height=30
onclick=click()
onkeypress=keyp ress()
onmousewheel=wh eel()
>
In other words, your click, keypress and wheel functions are not
listeners, so they will not receive an event object as their first
argument unless you pass it explicitly:

onclick-"click(even t)"

And no, I don't recommend doing it like that.

And why would you use canvas for this at all? It seems like the worst
possible choice for a cross-browser slider solution.
Oct 26 '08 #6

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

Similar topics

2
3751
by: Srinath Avadhanula | last post by:
Hello, Sorry to be bringing up what seems to be a somewhat beaten up topic... This is what I wanted to do: Create a _simple_ text editor widget which supports VI(M) style keybindings but works with arbitrary fonts/unicode characters. Vi(m) unfortunately, does not support Devanagari (or proportional fonts) and it looks like it will take quite some time for these things to work. As
5
2238
by: Douglas Alan | last post by:
Does anyone know if there is a widget for Tkinter available somewhere that implements something like the Microsoft Explorer View->Details mode, or the Apple iTunes track browser, or the Nautilus View as List mode? I.e., rows and colums of text, where the column widths can be adjusted by the user, and the user can click on a column header to sort the rows by that column? Thanks. |>oug
2
2963
by: Tonino | last post by:
Hi, I have a small Tkinter app that gets data from a socket connection to a "server". The app has a Text() widget to display the info that it gets from the socket connection. I have the ability to stop the text at any point. What I want to be able todo is select a line from the Text() window and double click or whatever on it to open a new window with that selected text as a paramater to the new window.
8
8883
by: Harlin Seritt | last post by:
I have the following script. Two widgets call the same function. How can I tell inside of the called function which button called it?: def say_hello(): print 'hello!' print widget root = Tk() button1 = Button(root, text='Button 1', command=say_hello) button1.pack()
6
10410
by: William Gill | last post by:
I am trying to get & set the properties of a widget's parent widget. What I have works, but seems like a long way around the block. First I get the widget name using w.winfo_parent(), then i convert the name to a reference using nametowidget(). self.nametowidget(event.widget.winfo_parent()).hasChanged= True It works, but I can't help but think I'm missing a more direct route. Am I? Bill
0
1160
by: William Gill | last post by:
I have a Tkinter (frame) widget that contains several other frame widgets, each containing entry widgets. In the parent frame I have a 'save' button that is initially disabled. As it is now, each widget has a hasChanged property that I can poll to see if updates to the source data need to be made. hasChanged is set to True by an event routine in each frame widget, and this works fine for my exit routine which knows to poll each widget...
0
1512
by: Tim N. van der Leeuw | last post by:
Hi, I need to display some hierarchical data, and because I don't want to force users to install too many things beyond Python itself, I'm hoping to use Tix which is at least included with Python. I've managed to use the Tix HList widget to display a tree of items (at least in a proof-of-concept miniprogram) but I actually need to display 2 columns -- perhaps more.
2
11703
by: Mudcat | last post by:
I am trying to change the width of a widget based on pixel size and not on characters. I can't figure out how to do this. Normally to change to the size of a widget it looks like: widget.configure(width = x) However that is in characters, not in pixels. To retrieve the actual size of a widget, I believe it is done with:
3
1675
by: mariox19 | last post by:
Are Tkinter widgets running on their own thread? If I try to make a simple application that will print the letters A to Z to a Tkinter Text widget, and I space the printing of each letter by 1 second, it seems no text will appear in the Text widget until the method exits. Take a look at this snippet: # Assume I have created no threads other than the one that comes
0
1004
by: Phil Thompson | last post by:
On Sunday 04 May 2008, Lance Gamet wrote: I think QMainWindow.setCentralWidget() is what you are looking for. The eric4 IDE probably covers most things you'll ever need. Phil
0
10147
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11547
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11136
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10677
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8238
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7399
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.