I'm using linux and dislike the InputBox widget. Are there any alternatives to it in the OPM?Hi @Curt, did you mean a TEdit? You can write your own custom InputBox using a TEdit ? I am just curious, what is your distro and what is it that you do not like about the widget?
I'm using the last 32bit Ubuntu system and using InputBox to input a 4 digit number. The box provided is way too wide, visually inconsistent (to my taste) with the standard Lazarus controls, and I don't know how to set its size.I have attached a zip file that has a fully working solution for you. It is heavily commented and I wish 'I' had something similar to learn from when I first started out learning free pascal and the ide.(I cut my teeth on Ubuntu Karmic 32bit and sometimes wish I had never moved on.)
I can live without the InputBox entirely and just use a TEdit, but was wondering if there were some other OS-independent message dialog components in the OPM. I suspect there are, and thought I'd ask rather than try and search something out myself.I have nothing against the OPM but I feel someone with 'your' specific analytical capabilities will have little trouble going through my code and understanding what was done. Always better to teach a man how to fish like my friend TRon said to me many moons back :-) Good luck and hope this will help!
I'll take a look. Thanks.You are very welcome. I have no clue how experienced (or not) you are with Lazarus and Free Pascal and am going by what I went through initially and if it was me looking at that code I sent your way I would feel a bit overwhelmed and nervous (which is quite normal) I would make a copy/backup first, then start fiddling with the code. Do give us some feedback if you find it useful or have any questions.
The box provided is way too wide, visually inconsistent (to my taste) with the standard Lazarus controls, and I don't know how to set its size.Study the code in the dialogs unit. There are two typed constants:
Worked like a charm.I sometimes look at this forum, and I am also delighted with the level of experts. Is it like, a gift from God or something? :)
I wonder if you could recommend a study guide or any organized approach that would lead me toward this level of understanding of Lazarus project organization? Where should one start to develop the level of knowledge that would let me do this sort of magic on my own? How did you learn about that constant (which is buried around line 753 (!!!) of the dialogs unit source code?The main point is that there is a simple trick how to navigate though any source code: Hold the CTRL key down and click on an identifier, and the IDE will open the unit in which this identifier is declared. Then press CTR:+SHIFT+Up/Down arrow to jump between interface and implementation sections of this unit.
I understand that typed constants can be assigned different values at runtime. But could you tell me why they aren't simply defined as variables in the unit in this instance?You mean var without an initial value?
Do all typed constants have global scope?Not 100% sure, but I think this is true. The "var" solution in the previous code section, however, would be possible to be used locally in procedures/functions. I do this often to avoid a "non-initialized variable" warning.
Do all typed constants have global scope?
Do all typed constants have global scope?
I did not know thatMe not either...