Page 1 of 1

A button in a button

Posted: Thu May 25, 2017 3:35 am
by skiman
Hi,

In a lot of modern webbased applications I saw buttons in a button. This kind of sub-buttons gives the possibility to add extra functionality to a button.

Sample: Stock button gives a list of products. The '+' button adds a new product. This way a user just has to click once.
stockbutton.PNG
stockbutton.PNG (2.02 KiB) Viewed 13245 times
As you can seen in the sample above, I have two buttons. The little push-button has another action according to the big Stock button.

The problem I now have is that when the STOCK button is clicked, the '+' button disappears to the back of the stock button. I'm looking to put the '+' button to front.

I tried with a oStockPlus:refresh() in the action of the stock button, but that doesn't work.

Any suggestions for this?

Re: A button in a button

Posted: Thu May 25, 2017 3:43 am
by skiman
Hi,

I found it.

Using oStockButton:toback() solved my problem.

Re: A button in a button

Posted: Thu May 25, 2017 10:11 pm
by c-tec
Hello,
looking nice your botton combination. A little tip: you can make the small button round with RADIUS in dcpushbuttonxp, I think this would look better.
regards
Rudolf

Re: A button in a button

Posted: Fri May 26, 2017 3:52 am
by skiman
Hi Rudolf,

Yes, the sample was made to show the two buttons.

This is how I implemented it in my application.
buttoninbutton.PNG
buttoninbutton.PNG (5.79 KiB) Viewed 13205 times
I changed the pushbuttonxp class with some extra:
:borderpixel to create a thick border which automatically calculates the color of the border.
:bgparent to set the background color of big button.
:circle which uses graarc to draw the button.

This way I can define my little buttons in a big button.

Re: A button in a button

Posted: Fri May 26, 2017 6:58 am
by rdonnay
You are saying that you modified the DC_XbpPushButtonXP() class?

I am planning another quick release of build 266.
I would like to see this plus your application code.

Re: A button in a button

Posted: Fri May 26, 2017 8:31 am
by skiman
Hi Roger,

I don't mind to share code, but I expect that my dc_pushbuttonxp isn't compatible anymore.

If you send me your _dcxbutt.prg, i can add the above modifications.

I didn't change the pushbuttonxp command, since I'm using the eval clause to set some values. I won't be a problem to add this to dcdialog afterwards.

1. The standard border has a value of one. I modified this with :borderpixel. If the borderpixel if > 1, then the color is calculated based on the :bgcolor of the current state. This way the bordercolor changes according to the standard bgcolor, bgmousover and bgselected.

2. The :bgparent sets a :bgcolor if there is no specific parent. The big button is not the parent of the small button, so I needed an extra value to define this. This way you can put the small button above another.

3. If :circle = .T. it is a sub-button in my case. This way I test on the :bgparent to paint the grabox. I also use the graarc to paint the button, instead of using the grabox with a radius of 999.

I don't know if the modifications are generic. Maybe you can change them to have some kind of subbutton clause in the command.

To have the above working in a nice way, the o:bgColorMouse:=o:bgcolor for the big button is a must.

If you think this is an addition to eXPress++ and users find this of interest I can share it.

Re: A button in a button

Posted: Fri May 26, 2017 8:57 am
by rdonnay
If you think this is an addition to eXPress++ and users find this of interest I can share it.
I was not thinking of it as an addition to eXpress++.
I thought it may have been something minor that would help you out with future releases.
I will forget about it and let you go about your business.

Re: A button in a button

Posted: Fri May 26, 2017 9:01 am
by skiman
Hi Roger,

This is the result of my button in a button.
buttonmenu.PNG
buttonmenu.PNG (30.81 KiB) Viewed 13184 times
I can easily add extra subbuttons on a button. The main goal was to have as much of direct options with ONE click.