How to customize Exoplayer material buttons? - customization

I am using this predefined Styled Player view XML code but I want to customize some of the buttons of this player view. Functions like (setClickable,setEnabled,setAlpha) are working fine on Buttons and ImageButtons but these functions are not working on MaterialButton as fast forward and rewind buttons are material buttons so these functions are not working on these buttons. Any other solution to customize these buttons..?
<com.google.android.exoplayer2.ui.StyledPlayerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/player_view"
app:use_controller="true"
android:keepScreenOn="true"
/>

Related

Is it possible to extend QColorDialog ui (c++)

I'm trying to make a dialog in QT c++ that asks for a color and some data input in text fields. I wanted to combine the color picker and text fields in the same dialog. Is it possible to somehow extend the QColorDialog to add this extra functionality or is there a better way without making my own color picker widget?

Customise button in QT

I need to create a toggle button in qt and it should look like the below image. It should show the ON image when it is turned on and remain at this state until it is toggled again. It should show the OFF image in the off case. Please help me on this.
You can use images as an icon (sadly, it won't scale with button by default), create a class which would paint those images in the handler for paint event, or you can use those images in QSS stylesheet. QSS is CSS 2.0 analog for Qt's GUI elements.
Note that after using stylesheet all changes to visuals of said element should be done through changes to stylesheet as well.
THose styles can be set through form editor by right-clicking a widget and choosing "Change stylesheet" or through code directly by calling setStyleSheet, depending which workflow you prefer.
button->setStyleSheet(
"QPushButton { border-image: url(:/Resources/chbUnchecked.png); }"
"QPushButton::checked { border-image: url(:/Resources/chbChecked.png); }" );
border-image Scales image to border limits, replacing standard border.There is also a background-image which fills widget's surface with regular repeats.
To limit this change only for checkable buttons:
button->setStyleSheet(
"QPushButton[checkable="true"] { border-image: url(:/Resources/chbUnchecked.png); }"
"QPushButton::checked[checkable="true"] { border-image: url(:/Resources/chbChecked.png); }" );
:/Resources/ is a path within app's resources.
QSS syntax: https://doc.qt.io/Qt-5/stylesheet-syntax.html
Note that QSS have selectors, so it's it have same "Cascading" ability as CSS. You can assign styles bulk based on hierarchical location on GUI, class-inheritances, class names, quasi-states and names.
If you set style above to a window, all instances of QPushButton within that window would have said style. If you define a new class for such Button, you can use its name instead of standard button class, although QSS for base class would apply to it.
the easiest way is to add the on-off images to your project as resources
then set the button as checkable and in its properties set the images to be rendered when is selected or not..(under icon -> selected on and selected off)
of course you have create images with a properly geometry... in the screenshot they look pretty small because I borrow them from your post..
:)

How can one set the background color of a property sheet

How can I change the background color of a property sheet? I can change the color of the actual pages by handling the WM_CTLCOLOR... messages but the tabs and other parts of the property sheet seem to be beyond my reach.
Might there be something in the callback?
Here's what it looks like when I handle the WM_CTLCOLOR msgs in the page dialogs.
Tab controls are notoriously difficult to work with. You will likely have to implement an owner-drawn tab control to get the level of customization that you want.

How to write a scrollable MFC custom control?

I want to write my own chart control which requires scrolling.
I found that there is a CScrollView but nothing like this for a control.
Other toolkits like Cocoa, QT or GTK offer me a base class where i can set a content view which is displayed in a viewport and saves me from writting all of the scrolling code.
The code for custom scrolling isn't that much. Create the scrollbars, write the message handlers and remember one rectangle for the current visible part.
I would just try it. If you have problems, we are here to help :-)

Writing controls like a button in C++\Win32 (not MFC or CLI)?

I have several questions concerning the controls like a button, if You could answer i would be very much pleased.
Questions:
Is there any way to create a control like a button, but not-standard, i mean, not that strict-rectangled button
How do I handle mouse hover events within the control
Regards,
Galymzhan Sh
It's relatively easy. If you want the same behaviour as a button (click, hover etc etc), then the best bet is to subclass the button control.
Have a read of the following MSDN articles:
http://msdn.microsoft.com/en-us/library/bb773183.aspx
http://msdn.microsoft.com/en-us/library/ms997565.aspx
http://msdn.microsoft.com/en-us/library/ms633569.aspx
This one is tricky one.
I developed my own GUI, it is advance topic.
Here is how i developed mine.
Create class called button
In button class, create all
variables needed like the width and
Height of the button
Have a render function
If you gonna let users load their own
texture for the button, you should
include a load function
Create class for wrapper
Have a Add button function and use ids for buttons
Have a EventProc that checks for hovers, clicks...
Have a Render controls function to render all buttons
This is just simple way to write buttons