Yii Framework Forum: [EXTENSION] spinner input field - Yii Framework Forum

Jump to content

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] spinner input field Rate Topic: -----

#1 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 21 May 2009 - 02:47 AM

This is my first try so I made something simple
A spinner input form field.
You can try a demo here
and download here

Also I'd appreciate if someone could tell me how to insert highligted color code in the documentation tab of the extension's page

Thanks
0

#2 User is offline   Q-efx 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 12-April 09

Posted 21 May 2009 - 07:44 AM

Cool thing! I would like to see this added: If you keep clicked on an element, the speed increase of the values passing by.
0

#3 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 21 May 2009 - 08:44 AM

Quote

Cool thing! I would like to see this added: If you keep clicked on an element, the speed increase of the values passing by.

I intend to add this feature.
I'm not that good with javascript but I'll think i can find a way
0

#4 User is offline   Q-efx 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 12-April 09

Posted 21 May 2009 - 08:59 AM

I think this should go something like this:

onclick="func"

func ( var a = 1 )
changefield(var a)
var b = a +1
sleep(100)
func(var B)

Iam now quite sure if iam right, but this should be the general "way" hope it helps that you know how to start and what to search ;)
0

#5 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 21 May 2009 - 09:08 AM

Good idea, this spinner control.

I would appreciate autorepeat with increasing speed every n'th tick until the mouseup event. I've done this in Javascript but need to improve the structure. In this case I guess a good solution would be to let the mousedown handler register element id, up/down direction and other params to the timer callback, make the first call to up/down, finally set off the timer. The mouseup handler will stop the timer. In the timer callback step will be incremented every n'th tick (to increase speed).

Unfortunately the demo doesn't work in IE6/IE7 for the text fields ('Object doesn't support this property or method'). Maybe the 'string' parameter in the call to up()? Numeric fields are OK.

I was unable debug this problem because I get a parse error (unexpected $end ... SSpinner.php ... on line 313) when including SSpinner in my page.

/Tommy

0

#6 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 21 May 2009 - 11:13 AM

* Version 1.1
When the mouse is pressed on the spinner the numbers increase/decrease faster
Fixed a bug with I.E. and string type spinners
0

#7 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 21 May 2009 - 11:15 AM

Quote

Good idea, this spinner control.



I would appreciate autorepeat with increasing speed every n'th tick until the mouseup event. I've done this in Javascript but need to improve the structure. In this case I guess a good solution would be to let the mousedown handler register element id, up/down direction and other params to the timer callback, make the first call to up/down, finally set off the timer. The mouseup handler will stop the timer. In the timer callback step will be incremented every n'th tick (to increase speed).



Unfortunately the demo doesn't work in IE6/IE7 for the text fields ('Object doesn't support this property or method'). Maybe the 'string' parameter in the call to up()? Numeric fields are OK.



I was unable debug this problem because I get a parse error (unexpected $end ... SSpinner.php ... on line 313) when including SSpinner in my page.



/Tommy


The problem in IE was an ID conflict of 2 elements. It's fixed now
Alaso as you can see there's a new version where when you keep the mouse button pressed the spinner increases/dicreases faster


0

#8 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 21 May 2009 - 11:27 AM

Thanks! I'll give it a try.

Probably I get the parse error because I didn't enable "short_open_tag" in php.ini

But, here is a quote from the PHP manual

Quote

Note: Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server. For portable, redistributable code, be sure not to use short tags.


0

#9 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 21 May 2009 - 11:46 AM

Thanks I changed the spinner_1_1.zip  with one with no short tags
0

#10 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 21 May 2009 - 12:11 PM

I tested the one with short tags. Works great! 8)

The stepping rate is too fast, I think.  My thought was to have an incremental stepping rate, starting with some initial rate and increasing with time elapsed since mousedown.

0

#11 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 21 May 2009 - 12:32 PM

This will be added as options (speed of spinner and use incremental speed or not ) in the next version
0

#12 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 22 May 2009 - 02:17 PM

Version 1.2
You can set the delay of the spinner's value update so you can control the speed of the spinner when the mouse is kept pressed on a button (Spinner's delay parameter)
Also when button is kept pressed this speed increases (Spinner's acceleration parameter. Values can be "none", "slow" , "normal" and "fast")
0

#13 User is offline   will 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 179
  • Joined: 21-March 09

Posted 22 May 2009 - 02:53 PM

Quote

Version 1.2

You can set the delay of the spinner's value update so you can control the speed of the spinner when the mouse is kept pressed on a button (Spinner's delay parameter)

Also when button is kept pressed this speed increases (Spinner's acceleration parameter. Values can be "none", "slow" , "normal" and "fast")


Great job!
0

#14 User is offline   mb 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 15-January 09

Posted 11 July 2009 - 12:10 PM

nice work!

how can i use the spinner for time?

i need the time in half hour steps - it is possible?
0

#15 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 12 July 2009 - 05:21 AM

If you want it in 2 spinners it's easy to set one for the hours and one for the minutes
If you mean something like 00:00, 00:30,1:30,2:00 etc it can't be done but it's a good idea so i'll try to implement it right now and I'll let you know
0

#16 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 13 July 2009 - 04:42 AM

Quote

nice work!



how can i use the spinner for time?



i need the time in half hour steps - it is possible?

I implemented the STimeSpinner.
I'll upload the update later , when I 'm finished with the documentation

0

#17 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 16 July 2009 - 01:18 AM

The new version including a Time Spinenr is available
http://www.yiiframew...ension/spinner/
Details documentation can be found here:
http://spyros.agilit...site/spinnerDoc
0

#18 User is offline   saegeek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 245
  • Joined: 09-December 09
  • Location:Montpellier - France

Posted 02 January 2010 - 05:56 AM

Hi,
I get :

Parse error: parse error in C:\wamp\www\protected\extensions\spinner\SNumericSpinner.php on line 211


There is a PHP short tag there...

Something else :

How I can add some $htmlOptions and make the text input manually editable (with keyboard) in the case of Numeric Spinner ?
And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
0

#19 User is offline   CoLT 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 246
  • Joined: 22-November 09

Posted 03 January 2010 - 11:20 AM

Same problems for me :-)
Parse error: parse error in C:\wamp\www\ssis\protected\extensions\spinner\STimeSpinner.php on line 211

[solved by appending <? by <?php ]

Another problem:
In view I would like to use time spinner.

1. Time spinner does not give neither take proper value from model in view _form:
$this->widget('application.extensions.spinner.STimeSpinner',
array(
"name"=>"Time",
"model"=>$model, //added model and attribute, but still no effect :)
"attribute"=>"Lenght",
"data"=>array(
"min"=>"06:00",
"max"=>"23:00",
"step"=>15,
"value"=>"12:00"
),
"width"=>60,
"delay"=>100,
"acceleration"=>"slow"
)
);
?>



---

Thanks for help!

Nice extension thought!
0

#20 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 04 January 2010 - 01:17 AM

Hi,
I'll take a look at these problems and I'll upload a new version soon

Thanks
0

Share this topic:


  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users