SwiftUI List - how to show row pressed state visual indication - list

How to show visual indication on list row press (each row contains a hstack/vstack with other views in it)
I have tried following code in init block but it is not getting reflected
UITableViewCell.appearance().selectedBackgroundView = someview with color
Is there anyway i can display selected background color when row is pressed
and automatically gets cleared when we release the touch

Related

Is there any way in SwiftUI to identify in a ListView which row is currently at a given position of a view

I wanted to provide a zooming effect to the images displayed in a ListView. Each time the list scrolls up & the item reaches top of my visible area. I want to zoom the image a little.

How to avoid unintended cell highlighting in QTableView

I have a QTableView set to multi selection mode, selection of entire rows. Works fine, only I get some kind of cell cursor I want to get rid off (row 71).
The following screenshot illustrates what I mean:
The rows I select with the mouse are highlighted in blue (see 69). But when I move around with the cursor keys the cells are somehow highlighted (see 71, 1st column - bit hard to see but visible). Any idea what is causing that?
Qt 5.6.1, widgets style is FUSION, Win10

C++ Win32 Trying to create an owner drawn toggle button

I have been trying for a very long time (well a few days) to create a toggle button. A button having a up or down state.
Took over a day to realize it is not possible to create an owner drawn toggle button, a checkbox and pushlike does not work. When using owner drawn there is no difference between a checkbox or regular button (MSDN also notes you cant use owner drawn with any of those styles.)
From reading I found out you have to do it yourself, normally not a problem at all, but I cannot get any real "responsiveness." That is, if I click fast, nothing happens, sometimes I will click and it changes states, other times not and only updates when I click a different button.
I created a global variable for if the button should be shown in up or down state. In the commands I have it set that when the button, IDC_BTN_TOGGLE, it will set the opposite value on the bool.
Then the draw item part:
// button down
if ((pDIS->itemState & ODS_SELECTED) || showButtonDown) {
oldBrush = (HBRUSH)SelectObject(pDIS->hDC, theme.hBrush[BRUSH_BUTTON2]);
}
// button up
else {
oldBrush = (HBRUSH)SelectObject(pDIS->hDC, theme.hBrush[BRUSH_BUTTON]);
}
All my buttons are owner drawn and run through this. showButtonDown is only true when it is drawing IDC_BTN_TOGGLE and the top bool is true as well.
The normal buttons function normally, when I click them, it instantly shows the down state, release, back to normal, the toggle button is barely responsive.

CDateTimeCtrl up down buttons reversed

I have a CDateTimeCtrl object in my application that displays a time in HH:MM:SS and has an up down control using DTS_UPDOWN. But when I highlight one of the fields and press the up button, it decreases and when pushing down, it increases. why would this be?

Owner drawing a checkbox List View

I have created a List view control with View = Icon / List, with LVS_EX_CHECKBOXES enabled.
And the checkboxes overlap with the items text, so I am wondering how could I create a owner drawn list view with checkboxes ?
I have seen that one has to process LVN_ITEMCHANGED notitication to test if an item has been checked.
How does this apply when the checkbox itself gets owner drawn, how do I approach this problem.
How Do I manage the events, the checkbox checking and unchecking while drawing my own, do I have to implement the checking routines myself or do I get something from the window? A message or something? While drawing my own checkbox how do I differentiate between a click on the item and a click on the checkbox, do I have to check the coordinates of the cursor when the click occured? how do I do this.
THis is with view= icon, it shows ok with view=list