Skip to main content

Questions tagged [setter]

Setter is public mutator method, used in object-oriented programming, which gives new value to a private member of a class.

setter
1 vote
1 answer
46 views

How to set some value to a parent control template property by clicking on button inside this template?

I want to implement some custom Search TextBox with a loop icon and placeholder. So I created a custom Control Template where there is TextBlock for the loop icon (I used some symbols from specific ...
5ORBEX's user avatar
  • 129
0 votes
0 answers
14 views

In Observablehq, how do I set property value for class in one cell from another cell, in the same notebook?

I am new to .js classes and I my goal is to set a property value for a class I define in one cell, from within another cell, where both cells are in the same notebook. In the example below, assume ...
ouonomos's user avatar
  • 744
-2 votes
0 answers
36 views

"mutating": var vs. func

enum SearchOption { case city(String) case address(String, Float?) case location((lat: Float, lon: Float), Float?) var radius: Float? { set { self = switch ...
Roman's user avatar
  • 1,485
1 vote
1 answer
57 views

Add a buffer period to WooCommerce Bookable products only if there are existing bookings

I'm using WooCommerce Bookings and if I add a buffer to a product using the admin UI it adds the buffer even if there are no bookings for that product on that day. That restricts the hours someone can ...
clev's user avatar
  • 13
0 votes
0 answers
37 views

C# WPF Setting padding on a grid in an more ergonomic way

I'm new to WPF and am a bit confused by the purposes of setters. For example, in a Grid, I would intuitively like to code this: <Grid Padding="5,5,5,5"> ... But I can't. I ...
Mark Roworth's user avatar
0 votes
1 answer
49 views

How does the Setter method work in Java in this example :

In the Setter Method "setName()", int the first line, name=this.name ; takes the value of the string "nidhi" in the second line, this.name=name; what actually happens i can't ...
HappyCoderNids's user avatar
0 votes
1 answer
66 views

LWC setter is not getting called

LWC setter is not getting called. <template> {message}<br><br>1. getter value: {displayMessage}<br><br>2. setter value: {updatedMessage} </template> import { ...
Salesforce developer's user avatar
1 vote
0 answers
45 views

Invoking setter method when modifying object's fields

I have a preferences class which I want to store and read to/from a database, reading the preferences happen a lot in my application so I want to store an intstance of this preferences object alive in ...
dnzssrl's user avatar
  • 11
0 votes
1 answer
39 views

Python Setter throws Type Error. What is wrong here?

I have a dataclass with an attribute 'open' of type float. I added a property setter which shall throw a ValueError in case it gets set to a negative value: @open.setter def open(self, value: float) -&...
Dennis's user avatar
  • 99
0 votes
1 answer
126 views

How to subclass Array in JavaScript and override 'length' getter and setter?

I am trying to subclass JavaScript array and override 'length' getter and setter. This code is not working - it outputs nothing to the console because getter and setter are not called. How to fix this?...
dvv's user avatar
  • 731
1 vote
3 answers
28 views

Conventions for property method, <>.setter and setter method names

Is there a convention for naming: 1.- the property method: in the example below, " def get_number (...)". Is that a good name? Should it be another one? 2.- the setter: in the example below &...
EstherPM's user avatar
0 votes
2 answers
225 views

Maui Custom Entry Behavior is blocking blocking Set call on ViewModel

I have created a custom behavior for the Entry control that allows a collection of Entry controls to provide a single-digit code input field that moves the cursor to the next field ( to the right ) ...
Sean Bennington's user avatar
0 votes
0 answers
33 views

Name Mangling In Python Regarding Setter methods

I had an issue with my setter methods not working when the if conditions were met, and I was not sure why (I ended up fixing it, but my question is WHY this fixed it). Here is my code: class Employee: ...
netorare's user avatar
0 votes
0 answers
42 views

python getter and setter properties

I am new to properties in Python and a bit confused on how below code is working class FavoriteShape: def __init__(self, color, shape): self.color = color self.shape = shape @...
a.J.'s user avatar
  • 1
0 votes
1 answer
34 views

how to override a setter of an abstract class to make the value final

Given an abstract class "Foo" that has a getter and setter for a "value" abstract class Foo<T> { T get value; set value(T newValue); } I'm trying to override getter and ...
Francesco Iapicca's user avatar

15 30 50 per page
1
2 3 4 5
119