Questions tagged [readonly-attribute]

126 questions
3
votes
2 answers

abstract class with readonly member

I have a class structure like this where an abstract class A holds an interface IB and a concrete class C in two variables. Which classes get assigned to that interface variable depends on the actual subclass A1, A2 that inherits the abstract class,…
downforme
  • 371
  • 2
  • 15
3
votes
1 answer

How to create read-only slots?

Slots are writable by default: >>> class A: __slots__ = ('x',) ... >>> list(vars(A)) ['__module__', '__slots__', 'x', '__doc__'] >>> vars(A)['x'] >>> a = A() >>> a.x = 'foo' >>> del a.x How to create read-only slots,…
Géry Ogam
  • 6,336
  • 4
  • 38
  • 67
3
votes
2 answers

Why does hasattr behave differently on classes and instances with @property method?

I implemented a write-only property in my class with @property. The weird thing is that hasattr behaves differently on the class and corresponding instance with this property. from werkzeug.security import generate_password_hash,…
Simba
  • 23,537
  • 7
  • 64
  • 76
3
votes
2 answers

Yii2: how to make a

I need to disabled or make readonly the icon of the yii2-date-picker-widget under the Yii2 framework. The datepicker widget has two parts: a for the icon and a for the date. I can disabled the using jQuery but I can't the…
Roby Sottini
  • 2,117
  • 6
  • 48
  • 88
3
votes
4 answers

cant get the value of a readonly textbox in asp.net

i have an asp,net textbox like this when i tried to get its value to a date variable LastService in code behind, i get this error Conversion from string "" to type…
Smith
  • 5,765
  • 17
  • 102
  • 161
2
votes
0 answers

Deal with TypeScript DeepReadonly state everywhere

I'm using simple Vue 3 Composition API stores to centralize the state of modules. After recommended good practices, the state is exported as readonly to prevent unwanted state mutation from the outside, being mutable only through the methods…
markusand
  • 235
  • 7
  • 18
2
votes
1 answer

python modifying frozen dataclass

I have a python dataclass whose attributes I didn't intend to modify. However, as I just realized, it is still modifiable via __dict__ even when I set frozen=True. For instance: @dataclass(frozen=True) class C: a: int = 1 c = C() c.a = 2 #…
David Chu
  • 23
  • 5
2
votes
1 answer

Is there a way to disable text for a drop down menu?

I'm trying to make a text field that has a drop down menu, but the user is only able to select options from the drop down menu. I want to disable the user's ability to type in the text box, while still allowing them to select an option, but I don't…
2
votes
1 answer

How to hide action button when QLineEdit is disabled?

I have a class which is inherited from QLineEdit, and I set an icon as an action button for this. MyEdit::MyEdit( QWidget *p_parent ) : QLineEdit( p_parent ) { m_buttonAction = addAction( QIcon( "search.png" ), QLineEdit::TrailingPosition ); …
songvan
  • 369
  • 5
  • 21
2
votes
1 answer

Clear readonly input date with jquery val() fails on Firefox, success on Chrome. Why?

I run into a different behaviour between Firefox and Chrome with JQuery.val('') Here is jsfiddle showing the issue. https://jsfiddle.net/mdqfbj/d4eovkg8/3/ A radio button calls a JS function to clear some fields, including some
Poutrathor
  • 1,990
  • 2
  • 20
  • 44
2
votes
1 answer

How to set read-only on a rails model using a attribute within the model?

How can I set a model to be read-only every time that it is accessed if an attribute within the same model is set to true? I have looked everywhere and the model read only seems to have very little documentation and even web results. Edit…
2
votes
3 answers

VS 2017 Installation failed

I install the VS2017 on Windows 7. After some time I receive the error: MSI: C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.VisualStudio.MinShell.Msi,version=15.6.27421.1\Microsoft.VisualStudio.MinShell.Msi.msi, Properties: …
ZedZip
  • 5,794
  • 15
  • 66
  • 119
2
votes
1 answer

Delphi 2007 - Allowing a Read-only file to be selected in a TSaveDialog

I have a need for a user to be able to select an existing read-only file from a save dialog. I thought you could do this with a judicious selection of the TSaveDialog options but I can't make it happen. If I select a R/O file, as soon as I hit…
rossmcm
  • 5,493
  • 10
  • 55
  • 118
2
votes
3 answers

md-datepicker - Input field should be readonly - No manual date entry allowed

What I want to achieve here is I would like to mark input field (child node of md-datepicker) should be marked readonly so that user can't enter date value manually (typing) and forced to select date from md-datepicker. I tried implementing this by…
2
votes
2 answers

Visual studio does not gray out properties with a ReadOnlyAttribute(true)

I know it's stupid but visual studio (2010) doesn't gray out my properties tagged with ReadOnlyAttribute, I can't edit their values (if I try to do it, simply return to the previous value), but they aren't grayed out, I think it's really boring this…
Francesco Belladonna
  • 11,361
  • 12
  • 77
  • 147
1 2
3
8 9