±ÍÇÏ´Â ¼Õ´Ô À̽ʴϴÙ
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ
  
  µ¨¸¶´ç °ø½Ä ÀºÇà°èÁÂ
  ÇϳªÀºÇà 227-910235-83607
  ¿¹±ÝÁÖ ÀÌ»ó±¹(¿î¿µÁø)
ÇÁ·ÎÁ§Æ® °Ô½ÃÆÇ
ÅõÇ¥°Ô½ÃÆÇ
µ¨¸¶´ç¼Ò°³
±âÃʺÎÅÍ È°¿ë±îÁö! µ¨ÆÄÀÌ ±³À° - µ¥ºê±â¾î
Áú¹®°ú ´äº¯ Áú¹®°ú ´äº¯ ÀÔ´Ï´Ù.
±Û³»¿ë - Áú¹®°ú ´äº¯
 [´äº¯][Áú¹®] A(¶Ç´Â a)´Â 12¼ýÀÚµÚ¿¡¸¸ ÀÔ·ÂÀÌ °¡´ÉÇÏ°Ô ÇÏ·Á¸é ¾î¶»°Ô ÇؾߠÇϳª¿ä?
µ¨´ë¿ÕÃʺ¸
(±èÇüµ¿)
2018-06-15 ¿ÀÈÄ 6:12:21
516ȸ Á¶È¸


µî·ÏµÈ ÆÄÀÏÀÌ ¾ø½À´Ï´Ù.
º£Æ®³²Àº 13 À̶ó´Â ¼ýÀÚ¸¦ ³Ê¹«³ªµµ ½È¾îÇؼ­ 13À» ÀÔ·ÂÀÌ ¾ÈµÇ°í, 12A·Î ÀÔ·ÂÇØ ´Þ¶ó°í Çؼ­ ÀÛ¼ºÁßÀÔ´Ï´Ù.
°æ¿ìÀÇ ¼ö°¡ ³Ê¹« ¸¹³×¿ä.
¾ÆÁ÷µµ ´Ù Àû¿ëÀ» ¸øÇß¾î¿ä. ¤Ð¤Ð

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var
  iLn, pos, cnt, n: integer;
  str, st1: string;
begin
  if K_NUMBER_MODE = 'NUMBER_MODE' then exit; // Ç¥ÁØ ¸ðµåÀ̸頱׳ɠ¸®ÅÏ

  if Key = #$61 then Key := #$41; // ¼Ò¹®ÀÚ a ´Â ´ë¹®ÀÚ A ·Î ¹Ù²Ù±â

  iLn := Length(Edit1.Text); // ¼¼´ë ID ±æÀÌ
  pos := Edit1.SelStart;     // ¼¼´ë ID Ä¿¼­ À§Ä¡
  cnt := StrLengthNoA(Edit1.Text);

  if ( ((Key >= #$30) and (Key <= #$39))or(Key = 'A')or(Key = 'a') ) then
  begin
    // -------------------------------------------------------------------------
    // A ÀԷ¿¡ ´ëÇÑ ÇÁ·Î¼¼½º
    // -------------------------------------------------------------------------
    if (Key = 'A')or(Key = 'a') then
    begin
      if iLn < 2 then // ±æÀÌ°¡ 2º¸´Ù ÀÛÀ¸¸é ÀÔ·ÂÀ» Clear ÇÑ´Ù
      begin
        Key := #0;
      end else
      begin
        if pos < 2 then // ÇöÀç À§Ä¡°¡ 2º¸´Ù ÀÛÀ¸¸é ÀÔ·ÂÀ» Clear ÇÑ´Ù
        begin
          Key := #0;
        end else
        if pos = 3 then // ÇöÀç À§Ä¡°¡ 3ÀΠ°æ¿ì´Â A¸¦ ÀÔ·ÂÇϸ頾ȵȴÙ
        begin
          Key := #0;
        end else
        begin
          if (iLn > pos) then // A ÀԷ ¿ìÃø¿¡ A°¡ ÀÖÀ¸¸é A ÀԷ °ÅºÎ
          begin
            st1 := Copy(Edit1.Text, pos+1, 1);
            if (st1 = 'A') or (st1 = 'a') then
            begin
              Key := #0;
              exit;
            end;
          end;
          str := Copy(Edit1.Text, pos-1, 2);
          if str <> '12' then Key := #0;
        end;
      end;
    end else
    // -------------------------------------------------------------------------
    // ¼ýÀÚ ÀԷ¿¡ ´ëÇÑ ÇÁ·Î¼¼½º
    // -------------------------------------------------------------------------
    begin
      if cnt >= 4 then // 12A12A´Â ±¦Âú´Ù, 12345 ´Ù¼¸ÀÚ¸®´Â ¾ÈµÈ´Ù
      begin
        Key := #0;
      end else
      begin
        if (iLn > pos) then // ÀԷ ¼ýÀÚ ¿ìÃø¿¡ A°¡ ÀÖÀ¸¸é Àüü »èÁ¦
        begin
          // ---------------------------------------------------------------------
          // A ÀԷ ¿ìÃø¿¡ A°¡ ÀÖÀ¸¸é Àüü »èÁ¦
          // ---------------------------------------------------------------------
          for n := pos+1 to iLn do
          begin
            st1 := Copy(Edit1.Text, n, 1);
            if (st1 = 'A') or (st1 = 'a') then
            begin
              Edit1.Text := '';
              Key := #0;
              exit;
            end;
          end;
        end;
        // ---------------------------------------------------------------------
        // ¼ýÀÚ 1 ÀԷµǾúÀ» ¶§, Æ¯Á¤ 13 ÀÔ·ÂÀº °ÅºÎ ÇÁ·Î¼¼½º
        // ---------------------------------------------------------------------
        if Key = #$31 then
        begin
          if iLn > 0 then
          begin
            if pos = 0 then
            begin
              str := Copy(Edit1.Text, 1, 1);
              if str = '3' then
              begin
                Key := #0;
                exit;
              end;
            end else
            if (iLn >= 3)and(cnt = 3)and(pos >= 3) then
            begin
              str := Copy(Edit1.Text, 1, 1);
              if str = '1' then
              begin
                Key := #0;
                exit;
              end;
            end;
          end;
        end;
        // ---------------------------------------------------------------------
        // ¼ýÀÚ 3 ÀԷµǾúÀ» ¶§, Æ¯Á¤ 13 ÀÔ·ÂÀº °ÅºÎ ÇÁ·Î¼¼½º
        // ---------------------------------------------------------------------
        if Key = #$33 then
        begin
          if iLn > 0 then
          begin
            if pos = 1 then
            begin
              str := Copy(Edit1.Text, 1, 1);
              if str = '1' then
              begin
                Key := #0;
                exit;
              end;
            end else
            if (iLn >= 3)and(cnt = 3)and(pos >= 3) then
            begin
              str := Copy(Edit1.Text, pos, 1);
              if str = '1' then
              begin
                Key := #0;
                exit;
              end;
            end;
          end;
        end;
      end;
    end;
  end else
  begin
    if Key = char(VK_BACK) then // ¹é½ºÆäÀ̽º´Â »ç¿ëµÇ¾î¾ß ÇÑ´Ù
    begin
      if (pos > 0) and (iLn > pos) then // A ÀԷ ¿ìÃø¿¡ A°¡ ÀÖÀ¸¸é Àüü »èÁ¦
      begin
        // ---------------------------------------------------------------------
        // A ÀԷ ¿ìÃø¿¡ A°¡ ÀÖÀ¸¸é Àüü »èÁ¦
        // ---------------------------------------------------------------------
        for n := pos+1 to iLn do
        begin
          st1 := Copy(Edit1.Text, n, 1);
          if (st1 = 'A') or (st1 = 'a') then
          begin
            Edit1.Text := '';
            Key := #0;
            exit;
          end;
        end;
      end;
    end else
      Key := #0;
  end;
end;

>> 1. °³¹ß/½ÇÇà Ç÷§Æû 
>>   (1) OS : Win10
>>   (2) °³¹ßÅø : XE8
>>   (3) »ç¿ë Database : 
>> 
>> 2. °³¹ß ÁßÀΠÇÁ·Î±×·¥ 
>>   ¼ýÀÚ ¹× A,a¸¸ ÀԷ ¹æ½Ä
>> 
>> 3. Áú¹® ³»¿ë
>> Edit¿¡ ¼ýÀÚ(0~9), A, a¸¸ ÀԷ¹޴ ÇÁ·Î±×·¥ÀÔ´Ï´Ù.
>> A(¶Ç´Â a)´Â 12¼ýÀÚµÚ¿¡¸¸ ÀÔ·ÂÀÌ °¡´ÉÇÏ°Ô ÇÏ·Á¸é ¾î¶»°Ô ÇؾߠÇϳª¿ä?
>> procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
>> var
>>   iLn: integer;
>> begin
>>   if ( ((Key >= #$30) and (Key <= #$39))or(Key = 'A')or(Key = 'a') ) then
>>   begin
>> 
>>   end else
>>   begin
>>     Key := #0;
>>   end;
>> end;
>> Á¶¾ðÀ» ±¸Çغ¾´Ï´Ù.
>>