a99  V32.6
allegro Windows Hauptprogramm
 Alle Klassen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
selbox.cpp
gehe zur Dokumentation dieser Datei
1 // selbox.cpp: Auswahlbox
2 // 1999
3 // Copyright 2011 Universitätsbibliothek Braunschweig, more see bottom
4 
5 #include "stdafx.h"
6 #include "ca99.h"
7 #include "a99.h"
8 #include "selbox.h"
9 
10 
11 #ifdef _DEBUG
12 #define new DEBUG_NEW
13 #undef THIS_FILE
14 static char THIS_FILE[] = __FILE__;
15 #endif
16 
17 #define WM_GOODBYE WM_USER + 5
18 
19 /////////////////////////////////////////////////////////////////////////////
20 // Dialogfeld selbox
21 
22 
23 selbox::selbox(CWnd* pParent /*=NULL*/)
24  : CDialog(selbox::IDD, pParent)
25 {
26  m_aView=pParent;
27  //{{AFX_DATA_INIT(selbox)
28  // HINWEIS: Der Klassen-Assistent fgt hier Elementinitialisierung ein
29  //}}AFX_DATA_INIT
30 }
31 
32 int selbox::Sel(char *ask)
33 { // leider umstaendlich, aber sonst kommt ask nicht rueber!
34  extern a99 *dlg;
35  extern int fadr(CHAR *,int lg=4);
36  strcpy(aSK,ask);
37  if(*aSK=='=') { strcpy(aSK,aSK+1); }
38  if(*aSK=='+') { amd=1; strcpy(aSK,aSK+1); }
39  if(*aSK=='#')
40  {
41  if(aSK[1]=='u')
42  {
43  int i=fadr((CHAR *)aSK);
44  if(i!=-1) strcpy(aSK,(char *)fa[i]+4);
45  }
46  else strcpy(aSK,(char *)dlg->Rec->Adr((CHAR *)aSK,0));
47  }
48  return CDialog::DoModal();
49 }
50 
52 {
53  extern char inpu[];
54  char val[128], *p;
55  m_selbox.GetWindowText(val,127);
56  if((p=strchr(val,'='))!=0) *p=0;
57  if(!amd) strcpy(inpu,val); // input -> inpu
58  else strcat(inpu,val);
59  CDialog::OnOK();
60 }
61 
63 {
64  extern int answ;
65  answ=IDCANCEL;
67 }
68 
69 
70 
72 {
74 // MoveWindow(250,300,415,96);
75 // ModifyStype klappt nicht:
76 // m_selbox.ModifyStyle(CBS_DROPDOWN,CBS_DROPDOWNLIST);
77 // m_selbox.RedrawWindow();
78  amd=0;
79  char *as;
80  extern a99 *dlg;
81  extern ABASE *BANK;
82  extern int fadr(CHAR *,int lg=4);
83  if(BANK) BANK->E3Coding((CHAR *)aSK,0,0); // ASCII -> ANSI
84  if(as=strchr(aSK,'='))
85  { *as++=0;
86  if(*as=='#')
87  {
88  if(as[1]=='u')
89  {
90  int i=fadr((CHAR *)as);
91  if(i!=-1) as=(char *)fa[i]+4;
92  }
93  else as=(char *)dlg->Rec->Adr((CHAR *)as,0);
94  }
95  else ;
96  }
97  if(as)
98  {
99  char *p; int i;
100  char aS[3000]; strcpy(aS,as);
101 // if(BANK) BANK->E3Coding((CHAR *)aS,0,0); // ASCII -> ANSI
102  p=aS;
103  while(*p)
104  {
105  i=0;
106  while(p[i] && p[++i]!='|') ;
107  if(!p[i]) { m_selbox.AddString(p); break; }
108  p[i]=0; m_selbox.AddString(p);
109  p+=i;
110  ++p;
111  }
112 
113  }
114  if(*aSK=='+') { amd=1; strcpy(aSK,aSK+1); }
115  m_title.SetWindowText(aSK);
116  m_selbox.SendMessage(CB_SHOWDROPDOWN,TRUE,0);
117 // Klappt nicht:
118 // m_selbox.ModifyStyle(CBS_DROPDOWN,CBS_DROPDOWNLIST);
119 // m_selbox.SetWindowPos(NULL,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME);
120  return TRUE;
121 }
122 
124 {
125 
126  return CDialog::DoModal();
127 }
128 
129 
130 void selbox::DoDataExchange(CDataExchange* pDX)
131 {
133  //{{AFX_DATA_MAP(selbox)
134  DDX_Control(pDX, IDC_EDIT1, m_title);
135  DDX_Control(pDX, IDC_SELCO, m_selbox);
136  //}}AFX_DATA_MAP
137 }
138 
139 
140 BEGIN_MESSAGE_MAP(selbox, CDialog)
141  //{{AFX_MSG_MAP(selbox)
142  ON_CBN_DBLCLK(IDC_SELCO, OnOK)
143  ON_WM_HELPINFO()
144  //}}AFX_MSG_MAP
145 END_MESSAGE_MAP()
146 
147 /////////////////////////////////////////////////////////////////////////////
148 // Behandlungsroutinen fr Nachrichten selbox
149 
150 void selbox::OnZ()
151 {
152  m_aView->SendMessage(WM_GOODBYE,8,0); // Alt+Z
153 }
154 
155 BOOL selbox::OnHelpInfo(HELPINFO* pHelpInfo)
156 {
157  return 1;
158 
159 // return CDialog::OnHelpInfo(pHelpInfo);
160 }
161 
162 
163 /*
164  Copyright 2011 Universitätsbibliothek Braunschweig
165 
166  Licensed under the Apache License, Version 2.0 (the "License");
167  you may not use this file except in compliance with the License.
168  You may obtain a copy of the License at
169 
170  http://www.apache.org/licenses/LICENSE-2.0
171 
172  Unless required by applicable law or agreed to in writing, software
173  distributed under the License is distributed on an "AS IS" BASIS,
174  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
175  See the License for the specific language governing permissions and
176  limitations under the License.
177 */
178