unset($_tmp_ctrl_); wb_create_control($maintab, Label, "This label control wraps words if they do not fit in the availble space.", 4, 195, 130, 45, IDC_SHAPE5065, WBC_VISIBLE | WBC_ENABLED | WBC_MULTILINE, 0, 2); wb_create_control($maintab, Label, "This one does not wrap anything.", 139, 195, 151, 16, IDC_SHAPE5066, WBC_VISIBLE | WBC_ENABLED, 0, 2); wb_create_control($maintab, Label, "This one uses ellipsis to display the text.", 139, 219, 110, 21, IDC_SHAPE5067, WBC_VISIBLE | WBC_ENABLED | WBC_ELLIPSIS, 0, 2); wb_create_control($maintab, PushButton, "&Test", 364, 24, 76, 26, IDC_BUTTON5068, WBC_VISIBLE | WBC_ENABLED | WBC_BORDER, 0, 2); wb_create_control($maintab, PushButton, "&Test", 280, 24, 76, 26, IDC_BUTTON5068, WBC_VISIBLE | WBC_ENABLED, 0, 2); $_tmp_ctrl_ = wb_create_control($maintab, Frame, "up_arrow.bmp", 250, 134, 65, 50, IDC_STATIC5070, WBC_VISIBLE | WBC_ENABLED | WBC_IMAGE | WBC_CENTER, 0, 2); wb_set_image($_tmp_ctrl_, 'C:\\@desenv\\WinBinder\\phpcode\\examples/../resources/up_arrow.bmp', GREEN); unset($_tmp_ctrl_); wb_create_control($maintab, Label, "This text is right-aligned.", 370, 79, 85, 35, IDC_STATIC5071, WBC_VISIBLE | WBC_ENABLED | WBC_RIGHT, 0, 2); // End controls // Control identifiers if (!defined("IDD_DLG6001")) { define("IDD_DLG6001", 6001); } if (!defined("IDC_EDIT6002")) { define("IDC_EDIT6002", 6002); } if (!defined("ID_LOWLEVEL")) { define("ID_LOWLEVEL", 6003); } if (!defined("ID_RESETHANDLER")) { define("ID_RESETHANDLER", 6004); } // Create window wbtemp_create_item($maintab, "Low-level"); // Insert controls wb_create_control($maintab, PushButton, "Run &Tests", 10, 14, 80, 30, ID_LOWLEVEL, WBC_VISIBLE | WBC_ENABLED, 0, 3); wb_create_control($maintab, EditBox, "", 194, 9, 275, 216, IDC_EDIT6002, WBC_VISIBLE | WBC_ENABLED | WBC_MULTILINE | WBC_READONLY, 0, 3); wb_create_control($maintab, PushButton, "Reset &Handler", 10, 50, 80, 30, ID_RESETHANDLER, WBC_VISIBLE | WBC_ENABLED, 0, 3); // End controls
function wb_create_items($ctrl, $items, $clear = false, $param = null) { switch (wb_get_class($ctrl)) { case ListView: if ($clear) { wb_send_message($ctrl, LVM_DELETEALLITEMS, 0, 0); } $last = -1; // For each row for ($i = 0; $i < count($items); $i++) { if (!is_scalar($items[$i])) { $last = wbtemp_create_listview_item($ctrl, -1, -1, (string) $items[$i][0]); } else { $last = wbtemp_create_listview_item($ctrl, -1, -1, (string) $items[$i]); } wbtemp_set_listview_item_text($ctrl, -1, 0, (string) $items[$i][0]); // For each column except the first for ($sub = 0; $sub < count($items[$i]) - 1; $sub++) { if ($param) { $result = call_user_func($param, $items[$i][$sub + 1], $i, $sub); wbtemp_set_listview_item_text($ctrl, $last, $sub + 1, $result); } else { wbtemp_set_listview_item_text($ctrl, $last, $sub + 1, (string) $items[$i][$sub + 1]); } } } return $last; break; case TreeView: if ($clear) { $handle = wb_delete_items($ctrl); } // Empty the treeview if (!$items) { break; } $ret = array(); for ($i = 0; $i < count($items); $i++) { $ret[] = wbtemp_create_treeview_item($ctrl, (string) $items[$i][0], isset($items[$i][1]) ? $items[$i][1] : 0, isset($items[$i][2]) ? $items[$i][2] : 0, isset($items[$i][3]) ? $items[$i][3] : -1, isset($items[$i][4]) ? $items[$i][4] : -1, isset($items[$i][5]) ? $items[$i][5] : 0); } return count($ret) > 1 ? $ret : $ret[0]; break; case StatusBar: wbtemp_create_statusbar_items($ctrl, $items, $clear, $param); return true; default: if (is_array($items)) { foreach ($items as $item) { wbtemp_create_item($ctrl, $item); } return true; } else { return wbtemp_create_item($ctrl, $items); } break; } }