Jump to content


Photo

Ext.ux.plugin.BadgeText

BadgeText plugin

  • Please log in to reply
29 replies to this topic

#1 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5177 posts

Posted 10 June 2014 - 11:05 AM

Hi All!

 

Ext.ux.plugin.BadgeText

 

Attached File  badgeTextPlugin.png   22.29KB   484 downloads

 

 

How to use?

 

1. Download the file BadgeText.js from here: https://github.com/C...er/BadgeText.js and copy to the directory /files/

 

2. Add CustomFiles in UniServerModule: 

files/BadgeText.js

3. UniButton1 -> ClientEvents -> UniEvents add beforeInit function

function beforeInit(sender)
{
  sender.action = 'badgetext'; 
  sender.plugins = [
                        {
                            ptype:'badgetext',
                            defaultText: 10,
                            disableOpacity:1,
                            disableBg: 'green',
                            align:'right'
                        }
                  ];
}

Use

For example: 

procedure TMainForm.UniButton1Click(Sender: TObject);var
  bJSName: string;
begin
  bJSName := (Sender as TUniButton).JSName;
  UniSession.AddJS(bJSName + '.setBadgeText(' + bJSName + '.getBadgeText() + 1);');
end;

source: https://github.com/C...lugin.BadgeText

demos and more config: https://fiddle.sencha.com/#fiddle/4dc

 

 

is another similar plugin... https://fiddle.sencha.com/#fiddle/2ar

 

 

Best regards.


  • 4

#2 ganzqgy

ganzqgy

    Advanced Member

  • Members
  • PipPipPipPip
  • 143 posts

Posted 10 June 2014 - 11:12 AM

good!


  • 0

#3 ganzqgy

ganzqgy

    Advanced Member

  • Members
  • PipPipPipPip
  • 143 posts

Posted 10 June 2014 - 12:27 PM

Cannot read property 'init' of null


  • 0

#4 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5177 posts

Posted 10 June 2014 - 12:57 PM

Cannot read property 'init' of null

 

Please what the problem is, I do not understand.


  • 0

#5 ganzqgy

ganzqgy

    Advanced Member

  • Members
  • PipPipPipPip
  • 143 posts

Posted 10 June 2014 - 01:26 PM

Don't work。

Can you  create a DEMO?


  • 0

#6 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5177 posts

Posted 10 June 2014 - 01:38 PM

Don't work。

Can you  create a DEMO?

 

I attached the file, try ...

 

Attached File  badgeText.zip   81.01KB   214 downloads


  • 1

#7 ganzqgy

ganzqgy

    Advanced Member

  • Members
  • PipPipPipPip
  • 143 posts

Posted 10 June 2014 - 01:47 PM

I do so, still can not successfully.


  • 0

#8 ganzqgy

ganzqgy

    Advanced Member

  • Members
  • PipPipPipPip
  • 143 posts

Posted 10 June 2014 - 01:49 PM

Successful, thank you, because you are not the same as the JS file.


  • 0

#9 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5177 posts

Posted 10 June 2014 - 01:56 PM

Successful, thank you, because you are not the same as the JS file.

 

https://raw.githubus...er/BadgeText.js


  • 0

#10 ganzqgy

ganzqgy

    Advanced Member

  • Members
  • PipPipPipPip
  • 143 posts

Posted 10 June 2014 - 01:59 PM

Thank you, this useful.


  • 0

#11 _Mehmet_

_Mehmet_

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 515 posts
  • LocationAntalya / Turkey

Posted 29 June 2014 - 01:51 PM

hi,

how change badget color ?


  • 0

#12 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5177 posts

Posted 29 June 2014 - 06:38 PM

Hi!

 

If in runtime, try

 

1. Change TextColor:

UniSession.AddJS(UniButton1.JSName + '.badgeEl.setStyle(''color'', ''red'');');

2. Change BackgroundColor:

UniSession.AddJS(UniButton1.JSName + '.badgeEl.setStyle(''background-color'', ''red'');');

Best regards.


  • 1

#13 _Mehmet_

_Mehmet_

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 515 posts
  • LocationAntalya / Turkey

Posted 30 June 2014 - 05:47 AM

Thank you


  • 0

#14 Arvin Feng

Arvin Feng

    Advanced Member

  • Members
  • PipPipPipPip
  • 100 posts
  • LocationChina (青石)

Posted 03 July 2014 - 07:06 AM

Good!


  • 0

#15 chefdackel

chefdackel

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 170 posts
  • LocationGermany

Posted 05 January 2015 - 12:57 PM



I attached the file, try ...

 

attachicon.gifbadgeText.zip

 

thank you very much. As the badgetext is created for buttons, its not so easy to adapt it to TabControls or Pagecontrols, such as here (see image down)? I could not make that work, but that would be another great field for badgetext:

Attached File  Unbenannt-1.jpg   15.87KB   92 downloads

 

brfc


  • 0

#16 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5177 posts

Posted 05 January 2015 - 01:07 PM

Hi chefdackel !

 

I will try..

 

Best regards.


  • 1

#17 billyChou

billyChou

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 126 posts

Posted 05 January 2015 - 02:02 PM

Thanks


  • 0

#18 chefdackel

chefdackel

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 170 posts
  • LocationGermany

Posted 05 January 2015 - 05:03 PM



Hi chefdackel !

 

I will try..

 

Best regards.

 

great, for UniGUI it may look like this, here for the TabControl (thanks to Photoshop), more usable for most of us would be a PageControl?
 

Attached File  Unbenannt-2.jpg   21.38KB   76 downloads

 

...there is few space for the badgetext. With UniTabControl and UniPageControl, even when putting some blanks at the end of the caption for a tab, the caption is trimmed from the blanks. Maybe there will be a need to change the caption of tabs in runtime, so f.e. "Tab1" if there is no value for the badgetext (and the badgetext is not shown at all), and f.e. "Tab1..." if there is a value for the badgetext. Only an idea. 

 

brfc


  • 0

#19 chefdackel

chefdackel

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 170 posts
  • LocationGermany

Posted 23 January 2015 - 10:23 AM

How to set visibility of the badgetext by code? Explanation:

 

I want to show the recordcount of a db table with the badgetext. As long as the recordcount is "0" I don`t want to show the badgetext, if the recordcount is not "0" I want to show the badgetext (by code):

 

if dbtable.recordcount =0 then

  [badgetext.visible=false]

else

  [badgetext.visible=true]

 

brfc

 


  • 0

#20 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5177 posts

Posted 23 January 2015 - 07:34 PM

Hi chefdackel !

Example, UniButton1 with badgeText:

Hide:

// if ....
UniSession.AddJS(UniButton1.JSName + '.badgeEl.hide();');

Show:

// if ....
UniSession.AddJS(UniButton1.JSName + '.badgeEl.show();');

Try...

Best regards.


  • 2





Also tagged with one or more of these keywords: BadgeText, plugin

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users