View Issue Details

IDProjectCategoryView StatusLast Update
0001420JEDI VCL00 JVCL Componentspublic2004-04-22 02:56
ReporteranonymousAssigned Touser72 
PrioritynormalSeveritytrivialReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0001420: Drawing bug in TJvIPAddress
DescriptionCompiler: D7 Pro
OS: WinXP Pro

When you use an XPManifest component and put an TJvIPAddress component on the same form. Then you can see a themed TJvIPAddress field but with strange black thick lines around each number. (see screenshot)

When you use the form without the XPManifest/XP-Theming then the IP edit field seems to be ok.

Hope somebody could fix this bug!
TagsNo tags attached.

Relationships

has duplicate 0002173 resolvedremkobonte jvIPAddress doesn't work with XPManifest 

Activities

2004-03-04 05:33

 

TJvIPAddress_Bug.jpg (43,159 bytes)
TJvIPAddress_Bug.jpg (43,159 bytes)

user72

2004-03-04 08:40

  ~0003180

I think it will be difficult fixing that since the control is a wrapper for a Windows control.

anonymous

2004-03-04 09:38

viewer   ~0003191

The strange thing is that windows xp uses this control for the TCP/IP settings also, but why is there not this problem? (see network settings of windows xp)

user72

2004-03-04 10:05

  ~0003193

I'm not so sure the control used in XP is the same as the one we have wrapped...

anonymous

2004-03-04 10:11

viewer   ~0003194

mmhh... Do you see another way to check out, if there is a possibility to use maybe another wrapper for windows xp?

This topic/component is very important for me. Maybe we get a great hint on torry delphi pages to point out this behavior?

Thanks in advance for you help!

user72

2004-03-04 10:38

  ~0003197

>Do you see another way to check out, if there is a possibility to use maybe
>another wrapper for windows xp?
I checked MSDN but couldn't find any XP specific info

anonymous

2004-03-04 12:00

viewer   ~0003198

Last edited: 2004-03-04 12:02

Ok... i tried to analyze this behavior. It's really the same class which is used for the TJvIPAddress component called "SysIPAddress32", also the important window style parameters are the same. When you change the font property in the TJvIPAddress component then the thick border around the child classes TEdit changes.

The following code works perfect also with the XPManifest. Maybe you can check out the differences between the direct CreateWindowEx API call and the TJvIPAddress component.

// ---

 
  Microsoft® Internet Explorer Version 4.0 introduces the IP address control,
  a new control similar to an edit control that allows the user to enter a
  numeric address in Internet protocol (IP) format.
  This format consists of four three-digit fields.
  Each field is treated individually; the field numbers are zero-based and
  proceed from left to right as shown in this figure.

  Further informations
  http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/ipaddress/ipaddress.asp
}

unit Unit1;

interface

uses
  Windows, Messages, Classes, Forms, Controls, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    IPAddress: TBevel;
    SetIP: TButton;
    ClearIP: TButton;
    procedure FormCreate(Sender: TObject);
    procedure SetIPClick(Sender: TObject);
    procedure ClearIPClick(Sender: TObject);
  private
    FIPAddress: Longint;
    HIPAddress: HWND;
    PrevWndProc: TWndMethod;
    procedure NewWindowProc(var Message: TMessage);
  public
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses
  CommCtrl;

const
  IP_ADDRESS_ID: Longword = $0100;

procedure TForm1.FormCreate(Sender: TObject);
var
  lpInitCtrls: TInitCommonControlsEx;
begin
  lpInitCtrls.dwSize := SizeOf(TInitCommonControlsEx);
  lpInitCtrls.dwICC := ICC_INTERNET_CLASSES;
  if InitCommonControlsEx(lpInitCtrls) then
  begin
    PrevWndProc := WindowProc;
    WindowProc := NewWindowProc;

    HIPAddress := CreateWindowEx(WS_EX_LEFT, WC_IPADDRESS, nil,
      WS_CHILD + WS_VISIBLE + WS_BORDER + WS_TABSTOP,
      IPAddress.Left, IPAddress.Top, IPAddress.Width, IPAddress.Height,
      Handle, IP_ADDRESS_ID, HInstance, nil);
    SendMessage(HIPAddress, IPM_SETFOCUS, 0, 0);
  end;
end;

procedure TForm1.NewWindowProc(var Message: TMessage);
var
  nField: longint;
begin
  case Message.Msg of
    WM_NOTIFY:
      begin
        if PNMHDR(Ptr(Message.lParam)).idFrom = IP_ADDRESS_ID then
        begin
          case PNMIPAddress(ptr(Message.lParam)).hdr.code of
            IPN_FIELDCHANGED:
              begin
                if SendMessage(HIPAddress, IPM_ISBLANK, 0, 0) = 0 then
                  SendMessage(HIPAddress, IPM_GETADDRESS, 0, lParam(LPDWORD(@FIPAddress)));
              end;
          end;
        end;
      end;
    WM_COMMAND:
      begin
        if Message.WParamLo = IP_ADDRESS_ID then
          case Message.WParamHi of
            EN_SETFOCUS:
              begin
                nField := SendMessage(HIPAddress, IPM_GETADDRESS, 0,
                  lParam(LPDWORD(@FIPAddress)));
                if nField = 4 then nField := 0;
                SendMessage(HIPAddress, IPM_SETFOCUS, wParam(nField), 0);
              end;
            EN_KILLFOCUS:
              begin
                if SendMessage(HIPAddress, IPM_ISBLANK, 0, 0) = 0 then
                  SendMessage(HIPAddress, IPM_GETADDRESS, 0, lParam(LPDWORD(@FIPAddress)));
              end;
            EN_CHANGE:
              begin
              end;
          end;
      end;
  end;
  if Assigned(PrevWndProc) then PrevWndproc(Message);
end;

procedure TForm1.SetIPClick(Sender: TObject);
begin
  FIPAddress := MAKEIPADDRESS(127, 0, 0, 1);
  SendMessage(HIPAddress, IPM_SETADDRESS, 0, lParam(DWORD(FIPAddress)));
end;

procedure TForm1.ClearIPClick(Sender: TObject);
begin
  SendMessage(HIPAddress, IPM_CLEARADDRESS, 0, 0);
end;

end.

// ---

Thanks again in advance for your great support/help!

edited on: 03-04-04 12:02

user72

2004-03-04 12:26

  ~0003199

The only really big difference I can see is in CreateParams, so try changing it to the following and see if that helps (I don't have XP, so I can't test myself):

procedure TJvIPAddress.CreateParams(var Params: TCreateParams);
const
  cTabStops: array[boolean] of Cardinal = (0, WS_TABSTOP);
begin
  InitCommonControl(ICC_INTERNET_CLASSES);
  inherited CreateParams(Params);
  CreateSubClass(Params, WC_IPADDRESS);
  with Params do
  begin
    Style := WS_CHILD or WS_VISIBLE or WS_BORDER or cTabStops[TabStop];
    WindowClass.style := WindowClass.style and not (CS_HREDRAW or CS_VREDRAW);
  end;
end;

Kai Gossens

2004-03-04 13:48

reporter   ~0003203

Last edited: 2004-03-04 13:51

Yeah... Great! It seems that i've solved the problem. The TJvIPAddress based on the TWinControl class and this seems wrong. The TJvIPAddress must based on the TCustomEdit class and then all problems are gone. I don't know how you could change this with the TJvIPAddress component which based on the subclass TJvWinControl... Exists a TJvCustomEdit class?

BTW: I have now signed up for a issue tracker account. No anonymous account anymore :-)

Thanks in advance for you great support/help!

edited on: 03-04-04 13:51

user72

2004-03-04 14:36

  ~0003205

Do you mean it works with the new CreateParams, new CreateParams + deriving from CustomEdit or old CreateParams + deriving from CustomEdit?

Kai Gossens

2004-03-04 14:56

reporter   ~0003206

New CreateParams but without window style WS_BORDER and only if it's derived from TCustomEdit! Don't ask me why... But it seems to work only in this combination.

2004-03-04 15:30

 

JvComCtrls.zip (12,849 bytes)

user72

2004-03-04 15:31

  ~0003207

Could you try the attached JvComCtrls file and see if it works on XP both with and without theming?

Note: You might have to rebuild the JvCore package as well

2004-03-05 05:16

 

JvComCtrls.pas (58,035 bytes)

Kai Gossens

2004-03-05 05:17

reporter   ~0003222

Hello Peter3,

as so often in our life it was completely something else than assumed. I've uploaded a new version of TJvComCtrls.pas which based on the latest CVS file. The main problem was the WM_CTLCOLOREDIT Message! :-)

It would be great if we could publish the color property and we should do some changes when the TJvIPAddress is in design state, because it's really hard to move this control over a form in delphi form designer. It always in edit state. And another bug: e. g. when you double click on the second field of the ipaddress then the first field only will be selected, but it should select the second field.

Thanks in advance for your help!
Kai

user72

2004-03-05 08:11

  ~0003230

> It would be great if we could publish the color property
I tried this and it works but if I change the color, only the color of the internal edits are changed, not the "border" around them. You can try it yourself and you'll see what I mean.

> it's really hard to move this control over a form in delphi form designer
This has already been fixed by Andreas but you may have to rebuld the package again to make it available.

Kai Gossens

2004-03-05 15:06

reporter   ~0003237

Hello again,

i don't know how we could paint the full background. I tried WMERASEBKGRND and WMPAINT message which works fine, but the dots between the internal edit controls gets lost. :-( Maybe we should append this as an known issue?

But the other reported error should be really fixed:

"e. g. when you double click on the second part of the IP-Address then only the first part will be selected, but it should select in this case the second part and so on"

user72

2004-03-05 18:19

  ~0003238

>. when you double click on the second part [...]
Already fixed that one :)

Kai Gossens

2004-03-06 01:26

reporter   ~0003239

When was this bug corrected and i which unit? I rebuild all packages and units, but it doesn't work. The design time bug fix from Andreas works fine. (also i have added the \run path to the library paths)

I think we should close this drawing bug issue, because it's solved with the WM_CTLCOLOREDIT Message. Maybe you could add these changes to the CVS?

Have you any ideas/extensions for the WM_PAINT oder WM_ERASEBKGRND messages?

user72

2004-03-06 04:55

  ~0003242

I haven't added the dblclick fix to CVS yet, but you only need to remove the WM_LBUTTONCLICK et al handler (the Perform call) to make it work. I haven't noticed any side-effects of this.

I'll update CVS with the changes so far and also add a note about the Color problem.

I'm also going to publish the Text, Color, ParentColor properties.

I'm closing this issue now and we can open a new one if we find additional problems. Thanks for all your help and ideas in fixing this problem.

Issue History

Date Modified Username Field Change
2004-03-04 05:33 anonymous New Issue
2004-03-04 05:33 anonymous File Added: TJvIPAddress_Bug.jpg
2004-03-04 08:40 user72 Note Added: 0003180
2004-03-04 08:43 user72 Status new => acknowledged
2004-03-04 09:38 anonymous Note Added: 0003191
2004-03-04 10:05 user72 Note Added: 0003193
2004-03-04 10:11 anonymous Note Added: 0003194
2004-03-04 10:38 user72 Note Added: 0003197
2004-03-04 12:00 anonymous Note Added: 0003198
2004-03-04 12:02 anonymous Note Edited: 0003198
2004-03-04 12:26 user72 Note Added: 0003199
2004-03-04 13:48 Kai Gossens Note Added: 0003203
2004-03-04 13:51 Kai Gossens Note Edited: 0003203
2004-03-04 14:36 user72 Note Added: 0003205
2004-03-04 14:56 Kai Gossens Note Added: 0003206
2004-03-04 15:30 user72 File Added: JvComCtrls.zip
2004-03-04 15:31 user72 Note Added: 0003207
2004-03-04 15:31 user72 Status acknowledged => assigned
2004-03-04 15:31 user72 Assigned To => user72
2004-03-05 05:16 Kai Gossens File Added: JvComCtrls.pas
2004-03-05 05:17 Kai Gossens Note Added: 0003222
2004-03-05 08:11 user72 Note Added: 0003230
2004-03-05 15:06 Kai Gossens Note Added: 0003237
2004-03-05 18:19 user72 Note Added: 0003238
2004-03-06 01:26 Kai Gossens Note Added: 0003239
2004-03-06 04:55 user72 Status assigned => resolved
2004-03-06 04:55 user72 Resolution open => fixed
2004-03-06 04:55 user72 Note Added: 0003242
2004-04-22 02:56 user72 Status resolved => closed
2004-09-26 14:44 remkobonte Relationship added has duplicate 0002173