Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 16 total
Thread Some Questions About EWB 2.02b1
Thu, Oct 15 2015 12:45 AMPermanent Link

Frederick Chin

After installing EWB 2.02b1 and working on a project, I have the following
questions:-

1.   Why is a TGrid not a selection in the FocusControl property of a TLabel?

2.   After adding a number of controls, I proceed to change the Name property of each control. At times, EWB will refuse the name change and display the attached message. The only way I can change the name is to exit EWB and restart it.

3.   Is it possible for the TGrid to have an auto width property so that the vertical scrollbar will not appear and the rightmost column will extend its width if the number of records fit within the grid's height? Currently, I have to leave a gap on the right so that when the vertical scrollbar appears, it will not partially cover the last column.

4.   How do I change the height of the grid's header? I can change the RowHeight but there seems to be no way to change the grid's header height.

5.   How do I set a display format for the column data within a grid? For example, I would like the data for numbers to have '#,0.00;-#,0.00' or '#,0;-#,0', the date format to be 'dd/mm/yyyy'.

6.   Is it possible to have incremental searching for the TEditComboBox? For example, if I type 'F' the cursor will position to the first option starting with 'F' and it I continue typing more letters, EWB will continue to reposition to the nearest option.

7.   I created two forms and one form (A) calls the other form (B). When form B is shown, the background of form B shows the hourglass mouse cursor. When the mouse moves back to within form B, the cursor changes to the default pointer. How do I set the mouse cursor to the default when the mouse is outside the boundaries of form B?

8.   Is there a theme control management in EWB? I would like most controls to be set the height of 25 instead of 34 and change the default font and background colours for buttons when they are dropped onto forms.

9.   In the OnCloseQuery event of a form, I have the following code:-

messagedlg('Are you sure you want to exit?', 'Please Confirm', mtConfirmation,  [mbYes,mbNo], mbNo, CheckConfirm);
Result:=lConfirmExit;

  and in the procedure CheckConfirm, I have the code:-

lConfirmExit:=(DlgResult=mrYes);

For some reason, the form does not close when I select Yes. Is there something I am missing?

Frederick



Attachments: rencomperror.png
Thu, Oct 15 2015 4:00 AMPermanent Link

Matthew Jones

Frederick Chin wrote:

> 7.   I created two forms and one form (A) calls the other form (B).
> When form B is shown, the background of form B shows the hourglass
> mouse cursor. When the mouse moves back to within form B, the cursor
> changes to the default pointer. How do I set the mouse cursor to the
> default when the mouse is outside the boundaries of form B?

Sounds like you used ShowModal. If you just Show it, then it won't do
that. Note though that the ModalResult of your question 9 then doesn't
work.

--

Matthew Jones
Thu, Oct 15 2015 4:27 AMPermanent Link

Frederick Chin

"Matthew Jones" wrote:

/*
Sounds like you used ShowModal. If you just Show it, then it won't do
that. Note though that the ModalResult of your question 9 then doesn't
work.
*/

Yes, I am using ShowModal. I don't want the user to click anywhere else while they are in this module.

After changing to Show, the hourglass cursor is gone but the OnCloseQuery still doesn't work. After I select Yes, the second form still shows.

Frederick
Thu, Oct 15 2015 6:36 AMPermanent Link

Walter Matte

Tactical Business Corporation

Frederick:


9.   In the OnCloseQuery event of a form, I have the following code:-

messagedlg('Are you sure you want to exit?', 'Please Confirm', mtConfirmation,  [mbYes,mbNo], mbNo, CheckConfirm);
Result:=lConfirmExit;

  and in the procedure CheckConfirm, I have the code:-

lConfirmExit:=(DlgResult=mrYes);



Not a desktop application - browser behaviour is different.  When you call MessageDlg - processing continues - it does not stop and wait for the dialog to appear.  So Result := lConfirmExit is executed immediately before you even have answered the question.

I have not checked but the new command "async" may work here you can test - it would look like this (I think)


async messagedlg('Are you sure you want to exit?', 'Please Confirm', mtConfirmation,  [mbYes,mbNo], mbNo, CheckConfirm);
Result:=lConfirmExit;


--------------------------------------

Otherwise you need to code something like this:

unit Unit1;

interface

uses WebCore, WebUI, WebForms, WebCtrls;

type

  TForm1 = class(TDialog)
     procedure Form1Create(Sender: TObject);
     function Form1CloseQuery(Sender: TObject): Boolean;
  private
     { Private declarations }
     procedure CheckConfirm(DlgResult: TModalResult);
  public
     { Public declarations }
     UserWantsToCloseTF : Boolean;
  end;

var
  Form1: TForm1;

implementation

procedure TForm1.Form1Create(Sender: TObject);
begin
  UserWantsToCloseTF := False;
end;


procedure TForm1.CheckConfirm(DlgResult: TModalResult);
begin
  if (DlgResult=mrYes) then
     begin
       UserWantsToCloseTF := True;
       Close;
     end;
end;


function TForm1.Form1CloseQuery(Sender: TObject): Boolean;
begin
 if UserWantsToCloseTF = False then
 begin
    MessageDlg('Are you sure you want to exit?','Please Confirm',
               mtConfirmation,[mbYes,mbNo],mbNo,CheckConfirm,True);
    result := false;
 end
 else
 begin
   result := true;
 end;
end;

end.



Walter
Thu, Oct 15 2015 6:41 AMPermanent Link

Walter Matte

Tactical Business Corporation

Fredrick:

8.   Is there a theme control management in EWB? I would like most controls to be set the height of 25 instead of 34 and change the default font and background colours for buttons when they are dropped onto forms.


NO there is no theme, that was EWB 1.

You have complete control over look and feel via the Interface of the controls - that you can change.

See the Manual - Getting Started - chapter on Control Interfaces.

and in Manual - Using the IDE - chapter Using the Control Interface Editor.

Walter
Thu, Oct 15 2015 10:49 AMPermanent Link

Frederick Chin

Walter,

/*
Not a desktop application - browser behaviour is different.  When you call MessageDlg - processing continues - it does not stop and wait for the dialog to appear.  So Result := lConfirmExit is executed immediately before you even have answered the question.
*/

I thought that since Messagedlg is a modal dialog, the application should just stop and wait for a user response before executing the next command line. Guess I was wrong.

/*
I have not checked but the new command "async" may work here you can test - it would look like this (I think)

async messagedlg('Are you sure you want to exit?', 'Please Confirm', mtConfirmation,  [mbYes,mbNo], mbNo, CheckConfirm);
Result:=lConfirmExit;
*/

I tried the "async" command and there is no change in the behaviour. EWB just plows through MessageDlg.

However,

/*
Otherwise you need to code something like this:
*/

This works fine. Thanks for the code!

Frederick
Thu, Oct 15 2015 10:59 AMPermanent Link

Frederick Chin

"Matthew Jones" wrote:

/*
Sounds like you used ShowModal. If you just Show it, then it won't do
that. Note though that the ModalResult of your question 9 then doesn't
work.
*/

I was giving your statement more thought and I can't understand why there needs to be an hourglass cursor when a modal form or dialog is shown.

It implies that some process is being carried out or a program has hung; neither of which is happening because the application is just waiting for user input or response.

I would prefer that the hourglass is shown based on my choice alone.

Frederick
Thu, Oct 15 2015 11:01 AMPermanent Link

Frederick Chin

Walter,

/*
NO there is no theme, that was EWB 1.

You have complete control over look and feel via the Interface of the controls - that you can change.

See the Manual - Getting Started - chapter on Control Interfaces.

and in Manual - Using the IDE - chapter Using the Control Interface Editor.
*/

Thanks for the reference. I'll need to tackle this soon.

Frederick
Thu, Oct 15 2015 11:54 AMPermanent Link

Frederick Chin

Frederick Chin wrote:

/*
3.   Is it possible for the TGrid to have an auto width property so that the vertical scrollbar will not appear and the rightmost column will extend its width if the number of records fit within the grid's height? Currently, I have to leave a gap on the right so that when the vertical scrollbar appears, it will not partially cover the last column.
*/

I am answering this myself and for anyone interested.

In the last grid column, set the StretchToFit property to True and the vertical scrollbar will appear if there are more rows than the grid's height. Otherwise, the scrollbar will not appear.

Frederick
Thu, Oct 15 2015 3:04 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< 1.   Why is a TGrid not a selection in the FocusControl property of a TLabel? >>

The FocusControl property expects a TInputControl, which is a TEdit, TMultiLineEdit, TEditComboBox, etc.  Grids can have *multiple* focusable input controls.

<< 2.   After adding a number of controls, I proceed to change the Name property of each control. At times, EWB will refuse the name change and display the attached message. The only way I can change the name is to exit EWB and restart it. >>

This has been an issue for a while (it's a Heisenbug).  Can you reproduce this, or give me some idea of which controls you placed on the form ?

<< 3.   Is it possible for the TGrid to have an auto width property so that the vertical scrollbar will not appear and the rightmost column will extend its width if the number of records fit within the grid's height? Currently, I have to leave a gap on the right so that when the vertical scrollbar appears, it will not partially cover the last column. >>

As you already found out:  TGridColumn.StretchToFit

<< 4.   How do I change the height of the grid's header? I can change the RowHeight but there seems to be no way to change the grid's header height. >>

Control interfaces:

http://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=Control_Interfaces

under "Customizing Control Interfaces".

<< 5.   How do I set a display format for the column data within a grid? For example, I would like the data for numbers to have '#,0.00;-#,0.00' or '#,0;-#,0', the date format to be 'dd/mm/yyyy'. >>

You can't do so currently.  You have to use these events to format any text for display:

http://www.elevatesoft.com/manual?action=viewevent&id=ewb2&comp=TDataColumn&event=OnGetText
http://www.elevatesoft.com/manual?action=viewevent&id=ewb2&comp=TDataColumn&event=OnSetText

<< 6.   Is it possible to have incremental searching for the TEditComboBox? For example, if I type 'F' the cursor will position to the first option starting with 'F' and it I continue typing more letters, EWB will continue to reposition to the nearest option. >>

No.  You can do so with the TButtonComboBox, but doing so with a TEditComboBox causes the input caret to jump around because the underlying control is an input control.

<< 7.   I created two forms and one form (A) calls the other form (B). When form B is shown, the background of form B shows the hourglass mouse cursor. When the mouse moves back to within form B, the cursor changes to the default pointer. How do I set the mouse cursor to the default when the mouse is outside the boundaries of form B? >>

Did you show the second form using ShowModal ?  If you don't want a modal form, then use Show instead of ShowModal.

<< 8.   Is there a theme control management in EWB? I would like most controls to be set the height of 25 instead of 34 and change the default font and background colours for buttons when they are dropped onto forms. >>

See Control Interfaces above.

<< 9.   In the OnCloseQuery event of a form, I have the following code:-

messagedlg('Are you sure you want to exit?', 'Please Confirm', mtConfirmation,  [mbYes,mbNo], mbNo, CheckConfirm);
Result:=lConfirmExit;

  and in the procedure CheckConfirm, I have the code:-

lConfirmExit:=(DlgResult=mrYes);

For some reason, the form does not close when I select Yes. Is there something I am missing? >>

Yes, you're checking the result of an asynchronous operation in the wrong place.  To do this correctly, you would need to use this code:

procedure TForm2.CheckConfirm(DlgResult: TModalResult);
begin
  lConfirmExit:=(DlgResult=mrYes);
  if lConfirmExit then
     Close;
end;

function TForm2.Form2CloseQuery(Sender: TObject): Boolean;
begin
  if (not lConfirmExit) then
     begin
     messagedlg('Are you sure you want to exit?', 'Please Confirm', mtConfirmation,  [mbYes,mbNo], mbNo, CheckConfirm);
     Result:=False;
     end
  else
     begin
     lConfirmExit:=False;
     Result:=True;
     end;
end;

Tim Young
Elevate Software
www.elevatesoft.com
Page 1 of 2Next Page
Jump to Page:  1 2
Image