43function wb_create_control($parent, $class, $caption=
"", $xpos=0, $ypos=0, $width=0, $height=0, $id=
null, $style=0, $lparam=
null, $ntab=0)
48 return wbtemp_set_accel_table($parent, $caption);
51 return wbtemp_create_toolbar($parent, $caption, $width, $height, $lparam);
54 return wbtemp_create_menu($parent, $caption);
57 return wbtemp_create_control($parent, $class, $caption, $xpos, $ypos, $width, $height, $id, $style,
58 is_null($lparam) ? NOCOLOR : $lparam, $ntab);
63 $ctrl = wbtemp_create_control($parent, $class, $caption, $xpos, $ypos, $width, $height, $id, $style, $lparam, $ntab);
64 if(is_array($caption))
69 $ctrl = wbtemp_create_control($parent, $class, $caption, $xpos, $ypos, $width, $height, $id, $style, $lparam, $ntab);
70 if(is_array($caption))
77 $ctrl = wbtemp_create_control($parent, $class, $caption, $xpos, $ypos, $width, $height, $id, $style, $lparam, $ntab);
83 return wbtemp_create_control($parent, $class, $caption, $xpos, $ypos, $width, $height, $id, $style, $lparam, $ntab);
98 $class = wb_get_class($ctrl);
105 elseif(is_string($value) && strstr($value,
","))
106 $values = explode(
",", $value);
107 elseif(!is_array($value))
108 $values = array($value);
111 foreach($values as $index)
112 wbtemp_set_listview_item_checked($ctrl, $index, 1);
118 $item = wb_get_selected($ctrl);
119 return wbtemp_set_treeview_item_value($ctrl, $item, $value);
123 if($value !==
null) {
124 return wbtemp_set_value($ctrl, $value, $item);
141 if(wb_get_class($ctrl) == ListView) {
145 $line = wbtemp_get_listview_text($ctrl, $item);
146 if($subitem ===
null)
149 return $line[$subitem];
153 $sel = wb_get_selected($ctrl);
157 $item = wbtemp_get_listview_text($ctrl, $i);
159 foreach($item as $col)
165 return $items ? $items :
null;
168 foreach($sel as $row)
169 $items[] = wbtemp_get_listview_text($ctrl, $row);
170 return $items ? $items :
null;
174 } elseif(wb_get_class($ctrl) == TreeView) {
177 return wbtemp_get_treeview_item_text($ctrl, $item);
179 $sel = wb_get_selected($ctrl);
183 return wbtemp_get_text($ctrl);
187 } elseif(wb_get_class($ctrl) == ComboBox) {
189 return wbtemp_get_text($ctrl, $item ===
null ? -1 : $item);
191 } elseif(wb_get_class($ctrl) == ListBox) {
193 return wbtemp_get_text($ctrl, $item ===
null ? -1 : $item);
197 return wbtemp_get_text($ctrl, $item);
216 switch(wb_get_class($ctrl)) {
222 if(!is_array($text) && $subitem !==
null) {
226 wbtemp_set_listview_item_text($ctrl, $item, $subitem, $text);
232 for($sub = 0; $sub < count($text); $sub++) {
234 if(($text[$sub] !==
null)) {
235 wbtemp_set_listview_item_text($ctrl, $item, $sub, (
string)$text[$sub]);
238 wbtemp_set_listview_item_text($ctrl, $item, $sub,
"");
246 $text = explode(
",", $text);
248 wb_delete_items($ctrl,
null);
251 wbtemp_clear_listview_columns($ctrl);
257 for($i = 0; $i < count($text); $i++) {
258 if(is_array($text[$i]))
259 wbtemp_create_listview_column($ctrl, $i,
260 (
string)$text[$i][0],
261 isset($text[$i][1]) ? (int)$text[$i][1] : -1,
262 isset($text[$i][2]) ? (int)$text[$i][2] : WBC_LEFT
265 wbtemp_create_listview_column($ctrl, $i,
266 (
string)$text[$i], -1, 0);
275 wb_delete_items($ctrl);
276 } elseif(is_string($text)) {
277 if(strchr($text,
"\r") || strchr($text,
"\n")) {
278 $text = preg_split(
"/[\r\n,]/", $text);
279 wb_delete_items($ctrl);
280 foreach($text as $str)
281 wbtemp_create_item($ctrl, (
string)$str);
286 } elseif(is_array($text)) {
287 wb_delete_items($ctrl);
288 foreach($text as $str)
289 wbtemp_create_item($ctrl, (
string)$str);
296 wb_delete_items($ctrl);
297 elseif(is_string($text)) {
298 if(strchr($text,
"\r") || strchr($text,
"\n")) {
299 $text = preg_split(
"/[\r\n,]/", $text);
300 wb_delete_items($ctrl);
301 foreach($text as $str)
302 wbtemp_create_item($ctrl, (
string)$str);
307 wb_send_message($ctrl,
WM_SETTEXT, 0, wb_get_address($text));
309 } elseif(is_array($text)) {
310 wb_delete_items($ctrl);
311 foreach($text as $str)
312 wbtemp_create_item($ctrl, (
string)$str);
319 return wbtemp_set_treeview_item_text($ctrl, $item, $text);
327 return wbtemp_set_text($ctrl, $text, $item);
329 return wbtemp_set_text($ctrl, (
string)$text, $item);
341 switch(wb_get_class($ctrl)) {
344 wb_send_message($ctrl,
CB_SETCURSEL, (
int)$selitems, 0);
348 wb_send_message($ctrl,
LB_SETCURSEL, (
int)$selitems, 0);
353 if(is_null($selitems)) {
354 return wbtemp_select_all_listview_items($ctrl,
false);
355 } elseif(is_array($selitems)) {
356 foreach($selitems as $item)
357 wbtemp_select_listview_item($ctrl, $item, $selected);
360 return wbtemp_select_listview_item($ctrl, $selitems, $selected);
364 return wbtemp_set_menu_item_checked($ctrl, $selitems, $selected);
367 wbtemp_select_tab($ctrl, (
int)$selitems);
371 wbtemp_set_treeview_item_selected($ctrl, $selitems);
388 switch(wb_get_class($ctrl)) {
399 for($i = 0; $i < count($items); $i++) {
400 if(!is_scalar($items[$i]))
401 $last = wbtemp_create_listview_item(
402 $ctrl, -1, -1, (
string)$items[$i][0]);
404 $last = wbtemp_create_listview_item(
405 $ctrl, -1, -1, (
string)$items[$i]);
406 wbtemp_set_listview_item_text($ctrl, -1, 0, (
string)$items[$i][0]);
410 for($sub = 0; $sub < count($items[$i]) - 1; $sub++) {
412 $result = call_user_func($param,
413 $items[$i][$sub + 1],
417 wbtemp_set_listview_item_text($ctrl, $last, $sub + 1,
$result);
419 wbtemp_set_listview_item_text($ctrl, $last, $sub + 1, (
string)$items[$i][$sub + 1]);
428 $handle = wb_delete_items($ctrl);
433 for($i = 0; $i < count($items); $i++) {
434 $ret[] = wbtemp_create_treeview_item($ctrl,
435 (
string)$items[$i][0],
436 isset($items[$i][1]) ? $items[$i][1] : 0,
437 isset($items[$i][2]) ? $items[$i][2] : 0,
438 isset($items[$i][3]) ? $items[$i][3] : -1,
439 isset($items[$i][4]) ? $items[$i][4] : -1,
440 isset($items[$i][5]) ? $items[$i][5] : 0
443 return (count($ret) > 1 ? $ret : $ret[0]);
447 wbtemp_create_statusbar_items($ctrl, $items, $clear, $param);
452 if(is_array($items)) {
453 foreach($items as $item)
454 wbtemp_create_item($ctrl, $item);
457 return wbtemp_create_item($ctrl, $items);
wb_create_control($parent, $class, $caption="", $xpos=0, $ypos=0, $width=0, $height=0, $id=null, $style=0, $lparam=null, $ntab=0)