질문,답변

글 수 1,629

Re: table에 데이터가 안들어가요.......

조회 수 6615 추천 수 0 2003.03.12 00:25:19
김충영 *.53.143.209
야리싸내님께서 남기신 글입니다.
>  이런 데이터가 있는데요....
>  char _TESTBENCH[44][6][3]={{"OFF","OFF","OFF","OFF","OFF","OFF"},{"OFF","OFF","OFF","OFF","OFF","OFF"},//2
>        {"OFF","OFF","OFF","OFF","ON", "OFF"},{"OFF","OFF","OFF","OFF","ON", "OFF"},//4
>        {"OFF","OFF","OFF","OFF","ON", "OFF"},{"OFF","OFF","OFF","OFF","ON", "OFF"},//6
>        {"OFF","OFF","OFF","OFF","ON", "ON" },{"OFF","OFF","OFF","OFF","ON", "OFF"},//8
>        {"OFF","OFF","OFF","OFF","ON", "ON" },{"OFF","OFF","OFF","OFF","ON", "OFF"},//10
>        {"OFF","OFF","OFF","OFF","OFF","OFF"},{"OFF","OFF","OFF","OFF","OFF","OFF"},//12
>        {"ON", "OFF","OFF","OFF","OFF","OFF"},{"ON", "OFF","OFF","OFF","OFF","OFF"},//14
>        {"ON", "OFF","OFF","OFF","OFF","OFF"},{"ON", "OFF","OFF","OFF","OFF","OFF"},//16
>        {"ON", "OFF","OFF","OFF","OFF","OFF"},{"OFF","ON", "OFF","OFF","OFF","OFF"},//18
>        {"OFF","ON", "OFF","OFF","OFF","OFF"},{"OFF","ON", "OFF","OFF","OFF","OFF"},//20
>        {"OFF","ON", "OFF","OFF","OFF","OFF"},{"OFF","ON", "OFF","OFF","OFF","OFF"},//22
>        {"ON", "OFF","OFF","OFF","OFF","OFF"},{"ON", "OFF","OFF","OFF","OFF","OFF"},//24
>        {"ON", "OFF","OFF","OFF","OFF","OFF"},{"OFF","OFF","OFF","OFF","OFF","OFF"},//26
>        {"OFF","OFF","OFF","OFF","OFF","OFF"},{"OFF","OFF","OFF","OFF","OFF","OFF"},//28
>        {"OFF","OFF","OFF","OFF","OFF","OFF"},{"OFF","OFF","OFF","ON", "OFF","OFF"},//30
>        {"OFF","OFF","OFF","ON", "OFF","OFF"},{"OFF","OFF","OFF","OFF","OFF","OFF"},//32
>        {"OFF","OFF","OFF","OFF","OFF","OFF"},{"OFF","OFF","OFF","OFF","OFF","OFF"},//34
>        {"OFF","OFF","OFF","OFF","OFF","OFF"},{"OFF","OFF","OFF","OFF","OFF","OFF"},//36
>        {"OFF","OFF","OFF","OFF","OFF","OFF"},{"OFF","OFF","OFF","OFF","OFF","OFF"},//38
>        {"OFF","OFF","OFF","OFF","OFF","OFF"},{"OFF","OFF","OFF","OFF","OFF","OFF"},//40
>        {"OFF","OFF","OFF","OFF","OFF","OFF"},{"OFF","OFF","OFF","OFF","OFF","OFF"},//42
>        {"OFF","OFF","OFF","OFF","OFF","OFF"},{"OFF","OFF","OFF","OFF","OFF","OFF"}};//44
> 
>  이걸..테이블의 첫번째 row,두번째 칼럼에서....왕창 아래로 넣고 싶어요.....
> 
>  SetTableCellRangeVals (panelECU, ECU_TABLE,MakeRect (1,2,44,6) ,(char **)_TESTBENCH, VAL_COLUMN_MAJOR);
> 
>  이렇게 했는데 에러메시지는 다음과 같습니다. --;
>  "The program has caused a 'General Protection' fault at 001B:683B3D4C"
> 
>  뭐...데이터는 3차배열인데...(char **)이라서...쫌..그렇지만...이렇게 안하면..컴파일 에러납니다.....--;
> 
>  혹시나 싶어서 이렇게도 해봤습니다.
>  for(i=1;i<45;i++)
>      SetTableCellRangeVals (panelECU, ECU_TABLE,MakeRect (i,2,1,6) ,(char **)_TESTBENCH[i-1], VAL_COLUMN_MAJOR);
> 
>  그래도..마찬가지군요....
>  어떻게해야...한꺼번에 왕창..넣을수 있을까요.....
>  또는 한줄씩...넣는 방법이라도....
> 

아직도 Table Control은 약간의 에러가지고 있는 것 같습니다.
전혀 함수에 오류가  없는데도 에러가 날때가 가끔 있읍니다.

void FillTable (int panel, int control)
{
    char *_TESTBENCH[44][6]={
          {"OFF","OFF","OFF","OFF","OFF","OFF"},
          {"OFF","OFF","OFF","OFF","OFF","OFF"},//2
          {"OFF","OFF","OFF","OFF","ON", "OFF"},
          {"OFF","OFF","OFF","OFF","ON", "OFF"},//4
          {"OFF","OFF","OFF","OFF","ON", "OFF"},
          {"OFF","OFF","OFF","OFF","ON", "OFF"},//6
          {"OFF","OFF","OFF","OFF","ON", "ON" },
          {"OFF","OFF","OFF","OFF","ON", "OFF"},//8
          {"OFF","OFF","OFF","OFF","ON", "ON" },
          {"OFF","OFF","OFF","OFF","ON", "OFF"},//10
          {"OFF","OFF","OFF","OFF","OFF","OFF"},
          {"OFF","OFF","OFF","OFF","OFF","OFF"},//12
          {"ON", "OFF","OFF","OFF","OFF","OFF"},
          {"ON", "OFF","OFF","OFF","OFF","OFF"},//14
          {"ON", "OFF","OFF","OFF","OFF","OFF"},
          {"ON", "OFF","OFF","OFF","OFF","OFF"},//16
          {"ON", "OFF","OFF","OFF","OFF","OFF"},
          {"OFF","ON", "OFF","OFF","OFF","OFF"},//18
          {"OFF","ON", "OFF","OFF","OFF","OFF"},
          {"OFF","ON", "OFF","OFF","OFF","OFF"},//20
          {"OFF","ON", "OFF","OFF","OFF","OFF"},
          {"OFF","ON", "OFF","OFF","OFF","OFF"},//22
          {"ON", "OFF","OFF","OFF","OFF","OFF"},
          {"ON", "OFF","OFF","OFF","OFF","OFF"},//24
          {"ON", "OFF","OFF","OFF","OFF","OFF"},
          {"OFF","OFF","OFF","OFF","OFF","OFF"},//26
          {"OFF","OFF","OFF","OFF","OFF","OFF"},
          {"OFF","OFF","OFF","OFF","OFF","OFF"},//28
          {"OFF","OFF","OFF","OFF","OFF","OFF"},
          {"OFF","OFF","OFF","ON", "OFF","OFF"},//30
          {"OFF","OFF","OFF","ON", "OFF","OFF"},
          {"OFF","OFF","OFF","OFF","OFF","OFF"},//32
          {"OFF","OFF","OFF","OFF","OFF","OFF"},
          {"OFF","OFF","OFF","OFF","OFF","OFF"},//34
          {"OFF","OFF","OFF","OFF","OFF","OFF"},
          {"OFF","OFF","OFF","OFF","OFF","OFF"},//36
          {"OFF","OFF","OFF","OFF","OFF","OFF"},
          {"OFF","OFF","OFF","OFF","OFF","OFF"},//38
          {"OFF","OFF","OFF","OFF","OFF","OFF"},
          {"OFF","OFF","OFF","OFF","OFF","OFF"},//40
          {"OFF","OFF","OFF","OFF","OFF","OFF"},
          {"OFF","OFF","OFF","OFF","OFF","OFF"},//42
          {"OFF","OFF","OFF","OFF","OFF","OFF"},
          {"OFF","OFF","OFF","OFF","OFF","OFF"}};//44
    int nCol, nRow;
    int Column, Row;
    int cellColor[] = {VAL_LT_GRAY, VAL_YELLOW};
    int i;
   
    Row = 44;
    Column = 6;

  GetNumTableRows (panel, control, &nRow);
  GetNumTableColumns (panel, control, &nCol);

  if (nCol>Column)
      DeleteTableColumns (panel, control, Column, nCol-Column);
  if (nRow>Row)
      DeleteTableRows (panel, control, Row, nRow-Row);
   
  if (nCol<Column)
      InsertTableColumns (panel, control, (!nCol ? 1 : nCol),
            Column-nCol, VAL_CELL_STRING);
  if (nRow<Row)
      InsertTableRows (panel, control, (!nRow ? 1 : nRow), Row-nRow,
              VAL_CELL_STRING);
  // 보통은 현재 있는 셀들을 모두 지우고 다시 만드는 것이 편리한데
      그렇게 하면 에러가 발생합니다. 제가 찾은 방법이 위 처럼 하는
      것인데 내용을 보면 이해할수 있으리라 생각 됩니다.
   
  SetTableColumnAttribute (panel, control, -1, ATTR_LABEL_BOLD, 1);
  SetTableRowAttribute (panel, control, -1, ATTR_LABEL_BOLD, 1);
  SetTableCellRangeAttribute (panel, control,  ABLE_ENTIRE_RANGE,
      ATTR_CELL_JUSTIFY, VAL_CENTER_CENTER_JUSTIFIED);
  // 위의 함수들은 Column,Row의 글자를 Bold로 만들고 셀에서
      값의 위치를 정 중앙으로 만듭니다.

  SetTableCellRangeVals (panel, control, MakeRect (1, 1, Row,
      Column), (char **)_TESTBENCH,  VAL_ROW_MAJOR);
  // 이 함수에서는 셀에 데이타를 입력하는데 변수가 3차원 포인터인데
      2차원 포인터로 Type Casting을 하였기 때문에 Direction값이
      VAL_COLUMN_MAJOR이 아니고 VAL_ROW_MAJOR로 하여야
      됩니다. 직접 해보시면 데이타 배열이 이상한 것을 알수 있읍니다.

  for (i=1; i<45; i++) {
      //SetTableCellRangeVals (panel, control, MakeRect (i, 1, 1,
            //Column), (char **)_TESTBENCH[i-1],
            //VAL_COLUMN_MAJOR);
      // 데이타를 한 줄별로 입력할때는 위와 같이 하면 됩니다.

      SetTableCellRangeAttribute (panel, control, MakeRect (i, 1, 1,
          Column), ATTR_TEXT_BGCOLOR, cellColor[i%2]);
      }
}

그럼 많은 도움이 되시길 바라며...
List of Articles
번호 제목 글쓴이 날짜 조회 수
공지 이제부터 질문은 LabWindows/CVI 카페를 이용하면 더 좋겠습니다 운영자 2020-11-11 1235
공지 파일(특히 그림파일)을 올리실 때의 유의사항 운영자 2004-07-16 100156
349 아날로그 입력을 받을 때... [2] 이한솔 2003-03-19 1538
348 TABLE의 셀 COLUMN의 크기 고정시키는방법.....? [3] 야리싸내 2003-03-18 1639
347 역행렬을 구하려는데요.... redan 2003-03-18 1588
346 1차원 array를 matrix로 이용해야합니다 [3] 허창원 2003-03-19 1596
345 일단은 2차원 배열을 사용하세요... 야리싸내 2003-03-18 1593
344 [C문법] 2차원 배열(포인터 상수)은 모든 element가 연속적입니다 허창원 2003-03-19 6919
343 항상 감사합니다. redan 2003-03-18 7734
342 graph에서 말입니다... [1] 이한솔 2003-03-14 1532
341 Re: graph에서 말입니다... [1] 야리싸내 2003-03-15 1680
340 BOOL 함수 질문 초보 2003-03-13 1669
339 [C문법] BOOL형의 이용 허창원 2003-03-19 1605
338 Thermocouple로부터 온도값을 얻으려면 허창원 2003-03-11 1565
337 Re: Thermocouple로부터 온도값을 얻으려면 [1] 야리싸내 2003-03-12 1612
336 table에 데이터가 안들어가요....... 야리싸내 2003-03-11 1539
» Re: table에 데이터가 안들어가요....... 김충영 2003-03-12 6615
334 감사합니다.......^^ 야리싸내 2003-03-12 1554
333 연습문제에 답은 없나요? ㅡㅡ;;; 하윤진 2003-03-10 1537
332 Re: 연습문제에 답은 없나요? ㅡㅡ;;; 허창원 2003-03-19 1547
331 sicl.h(GPIB관련..) 라이브러리 사용에 대해서 질문입니다^^ 강진욱 2003-03-07 1601
330 Re: sicl.h(GPIB관련..) 라이브러리 사용에 대해서 질문입니다^^ 허창원 2003-03-19 1651