Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread How to use the Function Sender Object
Fri, Mar 1 2013 12:55 PMPermanent Link

Markku Nevalainen

There probably is some simple answer to this, but I just can't find it
in the EWB documentation nor from the newsgroup.

procedure TForm1.Button1Click(Sender: TObject);
begin
  if Sender = Button1
  then Label1.Caption := 'Hello Btn1'
  else if Sender = Button2
  then Label1.Caption := 'Hello Btn2'
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  (Sender as TButton).Caption := 'You pressed me';
end;

Is there any way with EWB how you could use Sender parameter in this
traditional Delphi manner? Looks like EWB does not like or recognize
'as' keyword nor 'Sender'.

If not, what would be the suggested method to replace this functionality
in EWB? Thanks

Mats
Fri, Mar 1 2013 1:58 PMPermanent Link

Walter Matte

Tactical Business Corporation


Do the following... this is very Delphi...

procedure TForm2.Button1Click(Sender: TObject);
begin
 If Sender is TButton then
   TButton(Sender).Caption := 'Yes';
end;


Walter


Mats Nevalainen wrote:

There probably is some simple answer to this, but I just can't find it
in the EWB documentation nor from the newsgroup.

procedure TForm1.Button1Click(Sender: TObject);
begin
  if Sender = Button1
  then Label1.Caption := 'Hello Btn1'
  else if Sender = Button2
  then Label1.Caption := 'Hello Btn2'
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  (Sender as TButton).Caption := 'You pressed me';
end;

Is there any way with EWB how you could use Sender parameter in this
traditional Delphi manner? Looks like EWB does not like or recognize
'as' keyword nor 'Sender'.

If not, what would be the suggested method to replace this functionality
in EWB? Thanks

Mats
Sat, Mar 2 2013 12:01 PMPermanent Link

Markku Nevalainen

Walter Matte wrote:

> Do the following... this is very Delphi...

Thanks, that was exactly the trick that made it. The second problem
related to this same matter is this:

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  if Label2.Font.Color= clRed
  then Label2.Font.Color := clBlack
  else Label2.Font.Color := clRed;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  CheckBox1.Checked := NOT CheckBox1.Checked;
end;

That works in Delphi, when I click Button1, the Checkbox.Checked state
changes and the font color in Label2 changes.

With EWB only the Checked state changes, but the Label2 color does not
change, the event seems not Fire right. Any ideas for this?

I am looping through controls with ControlCount, and would like to
change several Checkboxes sates with one Button press.

---
Some other observations about EWB:

1) There seems not be Format -function available, to format Strings etc?

2) In EWB I miss Delphi variable Types like TCurrency, to avoid floating
point rounding errors.

3)IDE does not have Bookmarking capability, to be easily jump different
locations in code.

4) Pressing CTRL-F to open Find functionality automatically picks the
Word under cursor and places it to Find function. I would like to see
this in EWB also, the current Paint+Copy+Paste is bit tedious.

5) If you want to for instance Left Align 5 different controls, then
Delphi left aligns the controls according to the one that was first
picked. EWB does not care which was first choosed, it always
automatically aligns according to the leftmost control of those 5
controls. Not very handy.

6) The 912 pages "Elevate Web Builder Manual" is a bit clumsy when
trying to learn and find different things. I start to get tired watching
Adobe to slowishly scan this huge manual back and forth. It maybe would
be better if it was splitted to 2..4 different manuals and sections.

---
In general, its seems that you can do *something useful* with EWB. And
time to time I'll continue spending some time evaluating more of it.

I wonder if anyone  would have some simple example how to connect EWB to
MySQL database?

Thanks for any answers and suggestions.

Mats
Mon, Mar 4 2013 5:23 AMPermanent Link

Claudia Borsel

> 6) The 912 pages "Elevate Web Builder Manual" is a bit clumsy

Yes, but the same content is presented inside EWB-IDE in Menu Help - Elevate Web Builder Manual, which is easy to navigate through tree structure and internal links. So I prefer that.
Mon, Mar 4 2013 6:25 AMPermanent Link

Matthew Jones

> 3)IDE does not have Bookmarking capability, to be easily jump
> different locations in code.
>
> 4) Pressing CTRL-F to open Find functionality automatically picks
> the Word under cursor and places it to Find function. I would like
> to see this in EWB also, the current Paint+Copy+Paste is bit
> tedious.

I agree. Bookmarking would be brilliant - I am forever having to go find something
and then find where I was. The find is also quite a problem because I often go
somewhere to find a variable or other name, copy it to clipboard, and then to get
back to the function I was in I have to copy that to the clipboard and paste it to
find it. Slight flaw there... Improved navigation would be good. I can understand
this may not be a priority, but I wonder if there is a way to hook this so others
could implement such functions. (More work to do the hooks of course!)

/Matthew Jones/
Mon, Mar 4 2013 8:09 AMPermanent Link

Claudia Borsel

This Pascal-IDE is open source and has all the bells and whistles one could ask for:
http://www.pilotlogic.com/sitejoom/index.php/codetyphon/codetyphon-download

But unfortunately it can compile only for native CPU and for Java-VM, but not into Java-Script.

I don't know if it is possible to merge EWB into that IDE and keep EWB commercial at the same time.

But the efforts spent into that IDE are huge and can not be reproduced by a one-man show (? actually I don't know the number of elevate developers)  in EWB.
Tue, Mar 5 2013 9:28 AMPermanent Link

Markku Nevalainen

Claudia Borsel wrote:

> But the efforts spent into that IDE are huge

Also this IDE itself is quite huge. Total 476 MB in ZIP format. The
introduction does not say very much, so I installed it just to see what
is it actually.

Codetyphon seems to offer some new UI for Lazarus and other Pascal
dialects. That was a bit too heavy and complicated for me, to start
studying it as a new Editor for EWB use.

My D7 editor does not like EWB's .wbs files that are not old good ANSI
but Unicode files.

> and can not be reproduced by a one-man show (? actually I don't know the
> number of elevate developers)  in EWB.

Many Delphi developer companies in general are turning to be one man's
showsSmileIt is a bit hard to find anyone under 40 yrs and with with
Delphi knowledge.

Mats
Tue, Mar 5 2013 12:38 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mats,

<< With EWB only the Checked state changes, but the Label2 color does not
change, the event seems not Fire right. Any ideas for this? >>

You won't get a "click" event for a programmatic change to the checked
value.  You'll have to call the click event handler manually.

<< 1) There seems not be Format -function available, to format Strings etc?
>>

There's a very basic one called "Format" in the WebCore unit.  It only
allows for strings, though, in the form of '%s' placemarkers.  This function
is used internally by the translations in the framework.

<< 2) In EWB I miss Delphi variable Types like TCurrency, to avoid floating
point rounding errors. >>

There is no such thing in a web browser.  All numbers are essentially
floating-point numbers in JavaScript.

<< 3)IDE does not have Bookmarking capability, to be easily jump different
locations in code. >>

The code editor will be getting an overhaul some time this year.

<< 4) Pressing CTRL-F to open Find functionality automatically picks the
Word under cursor and places it to Find function. I would like to see this
in EWB also, the current Paint+Copy+Paste is bit tedious. >>

I'll see about adding an option for this.

<< 5) If you want to for instance Left Align 5 different controls, then
Delphi left aligns the controls according to the one that was first picked.
EWB does not care which was first choosed, it always automatically aligns
according to the leftmost control of those 5 controls. Not very handy. >>

I'll check this out and see what the problem is.

<< 6) The 912 pages "Elevate Web Builder Manual" is a bit clumsy when trying
to learn and find different things. I start to get tired watching Adobe to
slowishly scan this huge manual back and forth. It maybe would be better if
it was splitted to 2..4 different manuals and sections. >>

The PDF files are for printing hard-copies of the manual.  Please use the
built-in help in the IDE in order to allow for easy searching, etc.

<< I wonder if anyone  would have some simple example how to connect EWB to
MySQL database? >>

See here:

http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=1790#1790

If you have any other questions, please let me know.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Mar 5 2013 12:41 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Claudia,

<< This Pascal-IDE is open source and has all the bells and whistles one
could ask for: >>

It's a spin-off of Lazarus.

<< But unfortunately it can compile only for native CPU and for Java-VM, but
not into Java-Script. >>

The issue you run into with trying to use a native-code IDE with JavaScript
is the dual nature of the development vs. the web browser runtime
environment.  You effectively have to code things twice.

Tim Young
Elevate Software
www.elevatesoft.com
Image