Самоучитель по Delphi 7 для профессионалов



              

Создание нового компонента на базе элементов управления из библиотеки ComCtl32 - часть 5


//Msg.Result := Ord(Char(Msg.CharCode) = #9) ; end;}

procedure TCustomlPEdit.CMDialogChar(var Message: TCMDialogChar); 

begin with Message do

if CharCode = VKJTAB then 

begin

Message.Result := 0; if GetKeyState(VK_SHIFT)<>0 then 

begin

if (CurrentField=0) then Exit; CurrentField := CurrentField — 1;

 end

else 

begin

if (CurrentField=3) then Exit; CurrentField := CurrentField + 1; 

end;

Message.Result := 1; end //VK_TAB 

else

inherited; end;

{procedure TCustomlPEdit.CMDialogKey(var Message: TCMDialogKey); 

begin

if (Focused or Windows.IsChild(Handle, Windows.GetFocus)) 

and

(Message.CharCode = VK_TAB) and (GetKeyState(VK_CONTROL) < 0) then 

begin 

if GetKeyState (VK_SHIFT) 00 then

CurrentField := (CurrentField -1+4) mod 4 

else

CurrentField := (CurrentField + 1) ir.oci 4; Message.Result := 1; 

end else

inherited; end; }

function TCustomlPEdit.GetIP(Index: Integer): Byte;

 begin

SendMessage

(Handle,IPM_GETADDRESS,0,longint(@FipAddress));

case Index of

1 : Result := FIRST_IPADDRESS(FipAddress);

2 : Result := SECOND_IPADDRESS(FipAddress) ;

3 : Result := THIRD_IPADDRESS(FipAddress);

4 : Result := FOURTH_IPADDRESS(FipAddress); else Result := 0; 

end;

 end;

procedure TCustomlPEdit.SetIP(Index: Integer; Value: Byte);

 begin

 case Index of

1: FIPAddress := FIPAddress AND $FFFFFF or DWORD(Value) shl 24;

2: FIPAddress := FIPAddress AND $FFOOFFFF or DWORD(Value) shl 16;

3: FIPAddress := FIPAddress AND $FFFFOOFF or DWORD(Value) shl 8;

4: FIPAddress := FIPAddress AND $FFFFFFOO or DWORD(Value);

else Exit;

 end;

SendMessage(Handle, IPM_SETADDRESS, 0, FIPAddress); 

end;

function TCustomlPEdit.GetMinIP(Index: Integer): Byte; begin if (Index<0) or (Index>3) then

Result := 0

else

Result := LoByte(FIPLimits[Index]);

 end;

procedure TCustomlPEdit.SetMinIP(Index: Integer; Value: Byte); 

begin

if (Index<0) or (Index>3)




Содержание  Назад  Вперед