このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。

翻訳前ページへ


OnChange event handler, part 1, Lazarus tutorial -lt1Nd.htm HOME - - - - - Lazarus Tutorials TOC - - - - - - Other 構成要素 for programmers
Delicious  Bookmark this on Delicious    Recommend to StumbleUpon

取引,協定ing with Events

The edit box's OnChange event

This has good (警察などへの)密告,告訴(状), and a search button at the 底(に届く) of the page

Please don't 解任する it because it isn't 十分な of graphics, scripts, cookies, etc!

This page is "browser friendly". Make your browser window as wide as you want it. The text will flow nicely for you. It is easier to read in a 狭くする window. With most browsers, 圧力(をかける)ing 加える, minus or 無 while the 支配(する)/統制する 重要な (ctrl) is held 負かす/撃墜する will change the texts size. (大きくする, 減ずる, 回復する to default, それぞれ.) (This is more fully explained, and there's another tip, at my 力/強力にする Browsing page.)


If you have valiantly slogged through the first tutorial in my Lazarus programming series, you deserve a pat on the 支援する, and a break with a bit more fun in it.

That tutorial 始める,決める the scene regarding some of the working practices I recommend, and, for people with the 決意, lets them get started, even if they have never programmed in any language. But it wasn't much fun!

I will explain いっそう少なく in this tutorial. Go with the flow, and see if the ideas don't seep into you by osmosis.

This tutorial won't result in a clever 使用/適用, but it will result in something which, in a 未来 tutorial, will do something clever.

(That "未来 tutorial" isn't written yet, but the code that it will explain is. You can download a .zip with the code and a 収集するd .exe とじ込み/提出する in it. It is an 使用/適用 which 許すs 使用者s to enter 気温s in Celsius or Fahrenheit, and as soon as they do, they see the 気温 in the other 部隊s.)

All of what is explained here should, by the way, work the same way for any Delphi programmers reading this tutorial.

Here's what the finished 使用/適用 will look like, after a 使用者 has done some typing in one or the other or both of the edit boxes on the form. 結局, whatever you type in one will be copied to the other... but all letters in one will be made uppercase, whatever you type, and all letters in the other will be made lowercase.

Screenshot of tutorial's subject application

Start a new 使用/適用; put a "やめる" button on it. Put everything in a folder called LDN003, call the form LDN003f1, call the 使用/適用 LDN003, call the code ldn003u1.

("LDN003": Lazarus デモ (New), number 3. ("LD003" would be a Lazarus デモ 類似の to my Delphi デモ DD003. (Sadly, I forgot my 計画(する) until it was too late, and LD001 and LD002 are not 類似の to DD001 and 002.)) Aren't you glad you asked?)

Good! We've made a start!

Put two edit boxes on the form, 味方する by 味方する. 指名する them eUpper and eLower... for "uppercase" and "lowercase". "Upper"/ "lower" won't have anything to do with where the edit boxes are on the form.

二塁打-click somewhere on the form to 原因(となる) Lazarus to give you a 爆撃する "FormCreate" handler, and between the begin and the end, put...

eUpper.text:='';

... and run the 使用/適用.

After 直す/買収する,八百長をするing the 必然的な typos, you should have a form that has nothing in the eUpper edit box, and "eLower" in the other. And a "やめる" button that 作品. You should be able to enter text into the edit boxes, but nothing exciting happens when you do that.

二塁打-click on the eLower edit box to 原因(となる) Lazarus to give you a 爆撃する event handler, and between the begin and the end, put...

eUpper.text:=eLower.text;

... and run the 使用/適用.

I hope you didn't notice that when you 二塁打-clicked on the edit box, instead of getting a 爆撃する for the FormCreate event, you got a 爆撃する for the eLowerChange event? 陳謝s if you did, and worried.

Notice it now!

When you 二塁打-click on an 反対する (the form, a button, an edit box), Lazarus creates a 爆撃する for some "event"... but which event it creates the 爆撃する for depends on the sort of 反対する you 二塁打-clicked on. Happily, it is pretty good at choosing the event you would have chosen, and you can 無視/無効 the default when necessary, which won't be for a while, if you are a novice GUI programmer.

So. We've "followed the cookbook". What happens? If you've followed the cookbook 正確に when you run the 使用/適用, it looks just like it did before... at first.

If you start by changing things in the eUpper edit box, it still behaves as it did before.

But change the contents of the eLower edit box, and, Ta Da!... the eUpper edit box "echoes" what you type in the eLower edit box.

Not very "useful"... but pretty 魔法! 耐える with me... we are moving に向かって something useful. 結局, when you type a 気温 in Celsius into one of the text boxes, you will see the Fahrenheit 同等(の) in the other, and if you change what's in the Fahrenheit box, the Celsius number will change. Before a GUI interface with and event driven operating system... which is what you are using... creating an 使用/適用 like this would have been a nightmare. (You are using a GUI interface with and event driven operating system 関わりなく which Lazarus 環境 you are in, Linux, Windows or Mac.)

押し進める- Me- Pull- You

Now 二塁打-click on the eUpper edit box to 原因(となる) Lazarus to give you a 爆撃する event handler, and between the begin and the end, put...

eLower.text:=eUpper.text;

... and run the 使用/適用.

There's an 即座の difference. Both edit boxes are empty by the time your 注目する,もくろむ can 登録(する) what is in them.

The program started, at least internally, with nothing in eUpper because of the eUpper.text:='' in the FormCreate handler. But as soon as what was in eUpper changed, the eUpperChange event handler was 遂行する/発効させるd, resulting in eLower.text:=eUpper.text, so eLower became empty, too. All in the blink of an 注目する,もくろむ.

Type something in either edit box.

Now whatever you type in one echoes in the other, 関わりなく which edit box you type in.

We're going to go その上の with this 使用/適用 in a 未来 tutorial, but just before we end this one, let's make it a little more 利益/興味ing!

Ups and 負かす/撃墜するs

Lazarus (and Delphi) has two 機能(する)/行事s which we are going to use to make this 使用/適用 do something which I hope you will find entertaining. They are...

If 一時的に, you put the に引き続いて into your 使用/適用's FormCreate handler....

showmessage(uppercase('123abcDEF'));

... then when the 使用/適用 starts, a message box will appear on the 審査する with "123ABCDEF" in it. Notice that the "abc" in your code has become "ABC"

Change the 一時的な line to...

showmessage(lowercase('123abcDEF'));

... and then when the 使用/適用 starts, the message box will show "123abcdef" in it. Notice that the "DEF" has become "def".

A 機能(する)/行事 is said to return a value. The uppercase and lowercase 機能(する)/行事s return strings.. which is just 同様に, because the showmessage() 手続き must be given a string.

If you 約束 to go 支援する, read through that, and 約束 to think while we do the next bit, I will 差し控える from more "explaining"... for the moment.

Where 以前, you had....

手続き TLDN003f1.eLowerChange(Sender: TObject);
begin
  eUpper.text:=eLower.text;
end;

手続き TLDN003f1.eUpperChange(Sender: TObject);
begin
  eLower.text:=eUpper.text;
end;

... 追加する uppercase and lowercase and some brackets, to make...

手続き TLDN003f1.eLowerChange(Sender: TObject);
begin
  eUpper.text:=uppercase(eLower.text);
end;

手続き TLDN003f1.eUpperChange(Sender: TObject);
begin
  eLower.text:=lowercase(eUpper.text);
end;

... and play with the 使用/適用 again.

Apart from an annoying "thing" (which could be cured) which makes the insertion point jump around within the edit box you are typing in (いつかs), the 使用/適用 should now 持続する two copies of whatever you type. One in uppercase; the other in lowercase.

That's (almost) it for today!

On the little 事柄 of "On"

In Delphi help とじ込み/提出するs, anyway... I'm not familiar with Lazarus documentation yet... you will see people say things like "In the OnFormCreate event handler", and you will see "In the FormCreate event handler".

To be honest: I can't やめる get my 長,率いる around when it is 正確に/まさに 権利 to say "OnFormCreate" and when it is 権利 to say "FormCreate". The 反対する 視察官's "Events" tab 言及するs to the events 利用できる as OnActivate, OnClick, OnCreate, etc. But in the code, we see the same things without the "On".

Happily, for my 目的s these many years, knowing when I need the "On", and when I don't hasn't been a problem. I わびる for not giving you these tutorials with 絶対の technical perfection, but if you can live with my sloppiness, you are welcome to return. I'm now going to 令状 another tutorial, based on this one, but it will go その上の and create the Celsius/Fahrenheit convertor. Other people can go on worrying about the "on", if they wish. (But I do get 演習d about 訂正する use of apostrophes. Be 警告するd. I'm not a 完全にする slob.)





            力/強力にするd by FreeFind
  場所/位置 search Web search
場所/位置 地図/計画する    What's New    Search This search 単に looks for the words you enter. It won't answer "Where can I download InpOut32?"

If you visit 1&1's 場所/位置 from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service. They 申し込む/申し出 things for the beginner and the 会社/団体.www.1and1.com icon

広告 from page's editor: Yes.. I do enjoy 収集するing these things for you. I hope they are helpful. However... this doesn't 支払う/賃金 my 法案s!!! Sheepdog ソフトウェア (tm) is supposed to help do that, so if you 設立する this stuff useful, (and you run a Windows or MS-DOS PC) please visit my freeware and shareware page, download something, and 循環させる it for me? Links on your page to this page would also be 高く評価する/(相場などが)上がるd!
Click here to visit editor's freeware, shareware page.

Link to Lazarus Tutorials main page
How to 接触する the editor of this page, Tom Boyd


Valid HTML 4.01 Transitional Page 実験(する)d for 同意/服従 with INDUSTRY (not MS-only) 基準s, using the 解放する/自由な, 公然と accessible validator at validator.w3.org


If this page 原因(となる)s a script to run, why? Because of things like Google パネル盤s, and the code for the search button. Why do I について言及する scripts? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....