Coloured button background

2016-08-28 Thread Mitchell Shiller
Hi,

I would like to create a toolbar with buttons that have a custom color 
background but also can have the pop up menu property. (As seen on many web 
layouts).

Object Set Rgb Color does not allow me to change the background color of 
buttons, just the text color.

If I use a custom button type, I lose the pop up menu property.

Yes I could completely roll my own with multiple objects grouped together, but 
was wondering if anyone had any other ideas.

Thanks

Mitch


Sent from my iPad
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Coloured button background

2016-08-29 Thread Tom DeMeo
Hi,


If you set the platform to Printing on the Appearance/Platform setting, you 
lose the gradation and can set the color using object commands



Tom DeMeo



> On Aug 29, 2016, at 3:00 PM,Mitchell Shiller wrote:
> 
> Hi,
> 
> I would like to create a toolbar with buttons that have a custom color 
> background but also can have the pop up menu property. (As seen on many web 
> layouts).
> 
> Object Set Rgb Color does not allow me to change the background color of 
> buttons, just the text color.
> 
> If I use a custom button type, I lose the pop up menu property.
> 
> Yes I could completely roll my own with multiple objects grouped together, 
> but was wondering if anyone had any other ideas.
> 
> Thanks
> 
> Mitch

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Coloured button background

2016-08-30 Thread Mitchell Shiller
> Hi,
> 
> If you set the platform to Printing on the Appearance/Platform setting, you 
> lose the gradation and can set the color using object commands
> 
> Tom DeMeo

I can’t seem to get the fill color of the button to change.  Font color yes, 
fill no.
Any other ideas or am I missing something.

v14.5 OSX 10.11

Thanks

Mitch
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Coloured button background

2016-08-31 Thread Kirk Brooks
Mitchell,
I think you will need to create some graphic elements to use as backgrounds
for your buttons to achieve this. Colored buttons aren't part of anyone's
standard UI which is why, I think, 4D doesn't support them. Find or make up
what you need, put it in the Resources folder and there you go. If you are
using standard sizes you can reference the files directly from the button
object. If you need them to be able to resize or for varying size buttons
load them into variables and use the variables behind transparent buttons.

On Tue, Aug 30, 2016 at 2:47 PM, Mitchell Shiller 
wrote:

> I can’t seem to get the fill color of the button to change.  Font color
> yes, fill no.
> Any other ideas or am I missing something.
>
-- 
Kirk Brooks
San Francisco, CA
===
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Coloured button background

2016-08-31 Thread Tom DeMeo
Hi Mitch,



Not sure what the problem is. I created a demo. Download the link below. It has 
one project form with one button, with the object’s Appearance Platform set to 
“Printing". I change the color on load in the object method of the button. It 
works for me in 15 on OSX and Windows. 



https://drive.google.com/open?id=0B4EGxrgGEBl_U25RQ3dLM2VDZEk 




Tom DeMeo
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Coloured button background

2016-08-31 Thread Mitchell Shiller
Thanks Tom.

What I learned is that OBJECT SET COLOR works with regular buttons as your demo 
shows.
However, it does not work with 3D Buttons. I want to display an icon at the 
same time.
So I will roll my own.

Mitch

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Coloured button background

2016-09-01 Thread Arnaud de Montard

> Le 1 sept. 2016 à 04:30, Mitchell Shiller  a écrit :
> 
> Thanks Tom.
> 
> What I learned is that OBJECT SET COLOR works with regular buttons as your 
> demo shows.
> However, it does not work with 3D Buttons. I want to display an icon at the 
> same time.
> So I will roll my own.

Hi Mitchell, 
the 3d button, when it's set to "custom", allows a picture as background - a 
dog in this page:

In the properties list, these buttons have 2 references, icon and background. 
The last can be a colored rectangle. The source picture can be in Resource 
folder, picture library, variable. 
I ran a small test, with a Resource folder reference I don't get the background 
picture (bug, most probably) while with a picture from library or a variable 
it's OK.

Now if you want to change that color, get the string that describes the whole 
button format:
  $format_t:=OBJECT Get format(*;"buttont3dName")
You'll see a result like this:
  "Custom 
3D;#img/fieldTypes/Field_9.png;!MyBackgroundPictureVar;3;1;1;4;5;5;10;0;0;1"
where
   - Custom 3D = button title
   - #img/fieldTypes/Field_9.png = reference of the icon where "#" stands for 
"in Resource folder"
   - !MyBackgroundPictureVar = reference of the background where "!" stands for 
"in variable" 
Next step is to change the MyBackgroundPictureVar value, for example by 
generating a colored rectangle with svg:
  MyBackgroundPictureVar:=Pict_rectGet (Hasard_uuid)  //set a random color 
background
see 'Hasard_uuid' (to get a random number) here:
  
and 'Pict_rectGet' (from scratch):
***
  //Pict_rectGet (RGBcolor_l) -> img
  //returns a rectangle colored with $1
C_PICTURE($0)
C_LONGINT($1)
  //_
$svgRef:=SVG_New (120;20*4)
$RGBcolor_l:=$1
$txtColor_t:=SVG_Color_RGB_from_long ($1)
$X_l:=0
$largeur_l:=120
$hauteur_l:=18
$arrondiX:=5
$arrondiY:=10
$sp_l:=2
$tailleDuCrayon:=1
$frgndCol_t:=SVG_Color_RGB_from_long (0x00FF)
$bkgndCol_t:=SVG_Color_RGB_from_long ($RGBcolor_l)
ARRAY TEXT($bkgndCol_at;0)  //4 states
APPEND TO ARRAY($bkgndCol_at;SVG_Color_RGB_from_long ($RGBcolor_l))
APPEND TO ARRAY($bkgndCol_at;SVG_Color_RGB_from_long ($RGBcolor_l))
APPEND TO ARRAY($bkgndCol_at;SVG_Color_RGB_from_long ($RGBcolor_l))
APPEND TO ARRAY($bkgndCol_at;SVG_Color_RGB_from_long ($RGBcolor_l))
ARRAY TEXT($frgndCol_at;0)  //4 states
APPEND TO ARRAY($frgndCol_at;SVG_Color_RGB_from_long (0x))
APPEND TO ARRAY($frgndCol_at;SVG_Color_RGB_from_long (0x00FF))
APPEND TO ARRAY($frgndCol_at;SVG_Color_RGB_from_long (0x00FF))
APPEND TO ARRAY($frgndCol_at;SVG_Color_RGB_from_long (0x00AA))
For ($i_l;1;4)
$Y_l:=($i_l-1)*20
$rectID_t:=SVG_New_rect 
($svgRef;$X_l;$Y_l+2;$largeur_l+10;$hauteur_l-2;\

$arrondiX;$arrondiY;$bkgndCol_at{$i_l};$bkgndCol_at{$i_l};$tailleDuCrayon)
End for 
$0:=SVG_Export_to_picture ($svgRef)
  //_
***

-- 
Arnaud de Montard 

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Coloured button background

2016-09-01 Thread Mitchell Shiller
Merci Arnaud… mais  (but)

Custom buttons do not allow you to have a popup menu feature.  So I can get 
most of what I want but not all.
BTW, it is not to hard to create my own- using a text variable and the form 
events:On Mouse Enter, On Mouse Leave and On Clicked.  I can create a highlight 
effect when the object is rolled over. I add two picture variables one for the 
icon and one for the popup- hide them if not in use.  It is a pain to name all 
of the objects but..c’est la vie.

Thanks

Mitch

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Coloured button background

2016-09-01 Thread Jody Bevan
Mitch:

I think the way to get all that you want is to create an SVG object. Within 
this Object we had a two column pallet of buttons, where the users could: 
change the colours, and on the fly we could change background colour, text 
colour, text style. They could have popular or not on the fly. It would be very 
possible to have a picture for the SVG.

On the fly they could be made visible or invisible.

Sincerely
Jody Bevan

> On Sep 1, 2016, at 18:37, Mitchell Shiller  wrote:
> 
> Merci Arnaud… mais  (but)
> 
> Custom buttons do not allow you to have a popup menu feature.  So I can get 
> most of what I want but not all.
> BTW, it is not to hard to create my own- using a text variable and the form 
> events:On Mouse Enter, On Mouse Leave and On Clicked.  I can create a 
> highlight effect when the object is rolled over. I add two picture variables 
> one for the icon and one for the popup- hide them if not in use.  It is a 
> pain to name all of the objects but..c’est la vie.
> 
> Thanks
> 
> Mitch
> 
> 
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Coloured button background

2016-09-02 Thread Kirk Brooks
Mitch,
It's easy to roll your own menus on the fly for buttons or anything else
for that matter. I have dozens of them.

For simple lists I use the popup menu command:


$menu:="Item 1;Item2;Item3"
$result:=Pop up menu($menu)

Case of
: ($result>0)
  // do something
End case


For more involved menus, or if I want submenus, I build them:

$menu:=Create menu

APPEND MENU ITEM($menu;"Menu Item 0")
SET MENU ITEM PARAMETER($menu;-1;"0")

APPEND MENU ITEM($menu;"---")  // line

  // display the menu, get the result
$result:=Dynamic pop up menu($menu)
RELEASE MENU($menu)

Case of

:($result="0")

...

End case


​It's very fast to do this sort of thing and easy to put the code in
project methods you call from any object. ​I typically pop them up for On
click & Contextual click. And this is how I popup menus when a user clicks
a link or button on a web form.

On Thu, Sep 1, 2016 at 5:37 PM, Mitchell Shiller 
wrote:

> Custom buttons do not allow you to have a popup menu feature.  So I can
> get most of what I want but not all.
>
-- 
Kirk Brooks
San Francisco, CA
===
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**