标签: parent

如何将delphi上TPanel的所有TLabel复制到另一个TPanel?

我在delphi表单上有一个TPanel,当我按下一个按钮并将它们放在其他面板中时,我想复制所有与这个TPanel同属的TLabel.有没有办法做到这一点?谢谢.

delphi parent tlabel tpanel

0
推荐指数
1
解决办法
2798
查看次数

PHP中的子类和调用方法?

我来自Objective-C,面向对象编程只是一个梦想.(至少对于我来说)

我在PHP中有这个问题.我正在尝试创建一个Model-Class来保存我的数据库条目.它看起来像这样:

class Model {

    public function __set($name, $value)
    {
        $methodName = "set" . ucfirst($name);

        if (method_exists($this, $methodName)) {
            $methodName($value);
        } else {
            print("Setter method does not exists");
        }
    }

};
Run Code Online (Sandbox Code Playgroud)

我想将其子类化并创建一个类User.

class User extends Model {
    private $userID;

    public function userID() {
        return $this->userID;
    }

    public function setUserID($theUserID) {
        $this->userID = $theUserID;
    }

};
Run Code Online (Sandbox Code Playgroud)

当我打电话时,$user->__set("userID", "12345");我得到以下异常:

致命错误:在Model.class.php中调用未定义的函数setUserID()

$ user对象当然是User对象.为什么我不能从超类中调用方法?

php apache subclass parent

0
推荐指数
1
解决办法
142
查看次数

获取具有父类别名称和 id 的类别树

我有数据库表categoriesid, name, parent

我目前创建导航栏:

$rsCategories = mysql_query("SELECT * FROM categories WHERE hide = '0' ORDER BY parent, id");

$arrayCategories = array();

while($row = mysql_fetch_assoc($rsCategories)){ 
    $arrayCategories[$row['id']] = array("parent" => $row['parent'], "name" => $row['name']);   
}

function createTree($array, $currentParent, $currLevel = 0, $prevLevel = -1) {

    foreach ($array as $categoryId => $category) {

        if ($currentParent == $category['parent']) {                        

            if ($currLevel > $prevLevel) echo " <ul> "; 

            if ($currLevel == $prevLevel) echo " </li> ";

            echo '<li id="'.$categoryId.'"><a href="/categorie/'. strtolower(str_replace(" ", …
Run Code Online (Sandbox Code Playgroud)

php parent categories

0
推荐指数
1
解决办法
3508
查看次数

从 XAML 中的 ControlTemplate 访问按钮的 Tag 属性

在我的窗口中,我有一系列六个按钮,它们指示我的 ViewModel 属性之一的六种可能状态。需要突出显示处于活动状态的那个。为此,我为按钮创建了以下 ControlTemplate:

<ControlTemplate x:Key="SnijRichtingTemplate" TargetType="Button">
    <Border Name="toggleButton" BorderThickness="1" BorderBrush="{StaticResource KleurRadioCheckOuter}" Background="Transparent" Width="20" Height="20" Cursor="Hand">
        <TextBlock Name="text" Foreground="{StaticResource KleurRadioCheckOuter}"
                   Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Tag}"
                   ToolTip="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Tag.ToolTip}"
                   HorizontalAlignment="Center" VerticalAlignment="Center" />
    </Border>

    <ControlTemplate.Triggers>
        <DataTrigger Value="True">
            <DataTrigger.Binding>
                <MultiBinding Converter="{StaticResource EqualityToBooleanConverter}">
                    <Binding Path="SnijRichting" />
                    <Binding Path="Tag" RelativeSource="{RelativeSource TemplatedParent}" />
                </MultiBinding>
            </DataTrigger.Binding>
            <Setter TargetName="toggleButton" Property="BorderBrush" Value="{StaticResource KleurTekstDonker}" />
            <Setter TargetName="text" Property="Foreground" Value="{StaticResource KleurTekstDonker}" />
        </DataTrigger>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter TargetName="toggleButton" Property="BorderBrush" Value="{StaticResource Kleur2}" />
            <Setter TargetName="text" Property="Foreground" Value="{StaticResource Kleur2}" />
        </Trigger>
    </ControlTemplate.Triggers>
</ControlTemplate> …
Run Code Online (Sandbox Code Playgroud)

wpf xaml binding parent controltemplate

0
推荐指数
1
解决办法
1788
查看次数

Div不会插入父div

我制作了这个html css文件.我想将黄色div(id = map)放入父div(id = main)中,但是这个黄色div不会进入父div.我不知道该怎么办 .请帮我解决这个问题.

<html>
<head>
    <meta charset="UTF-8"/>
    <title>My Real Project</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        #container{
            position:absolute;
            width:100%;
            height:100%;
        }
        #header{
            position:relative;
            width:1000px;
            height:170px;
            margin: 0 auto;
            background-color:lightgreen;
        }
        #footer{
            position:relative;
            width:1000px;
            height:170px;
            margin: 0 auto;
            background-color:lightblue;
            bottom:0;
        }
        #main{
            position:relative;
            width:1000px;
            height:600px;
            background-color:darkred;
            margin: 0 auto;
            z-index:1;
        }
        #tools{
            position:relative;
            left:0;
            background-color:orange;
            width:260px;
            height:100%;
            z-index:2;
        }
        #map{
            position:relative;
            right:0;
            width:740px;
            height:100%;
            z-index:2;
            background-color:yellow;
        }
    </style>
    <script>

    </script>
</head>
<body>
    <div id="container">
        <div id="header">Place the header …
Run Code Online (Sandbox Code Playgroud)

html css parent

0
推荐指数
1
解决办法
75
查看次数

通过 JavaScript 或 jQuery 删除其中包含不间断空格的 P 标签

所以我从我们的内容发布者正在使用的 API 接收到不干净的内容,我得到了 P 标签,其中包含不间断空格,我想删除不间断空格和它所在的 P。这会很好如果他们在将内容发布到 API 之前清理了他们的内容,但我只需要一种通过 JavaScript 或 jQuery 快速删除它的方法。使用以下代码时出现此错误。“语法错误,无法识别的表达式:”感谢您的帮助。

<p>&nbsp;</p>

$("p").each(function() {
    $(this).find('&nbsp;').remove();
});
Run Code Online (Sandbox Code Playgroud)

html javascript jquery parent paragraph

0
推荐指数
1
解决办法
2093
查看次数

stat() 不适用于父目录

我正在尝试ls用 C编写命令,但stat()拒绝打开任何其他目录。

 ~/Desktop/ls$ cat bug.c 
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdlib.h>
#include <stdio.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <unistd.h>

int     main(int ac, char **av)
{
  DIR       *d;
  struct dirent *dir;
  struct stat   file;

  d = opendir(av[1]);
  if (d)
    {
      while ((dir = readdir(d)) != NULL)
        {
          printf("%s ->", dir->d_name);
          if (lstat(dir->d_name, &file) < 0)
          printf(" can't read file %s!", dir->d_name);
          printf("\n");
        }
    }
  closedir(d);
  return (0);
}
Run Code Online (Sandbox Code Playgroud)

运行时./a.out。或任何子文件夹,它工作正常。但是如果我写./a.out .. …

c directory parent stat

0
推荐指数
1
解决办法
2278
查看次数

如何href链接到我的文件所在文件夹之外的文件夹中的文件?

我的文件是这样设置的:

                               Root
                                 |
          tours----------------about----------------gallery
            |                    |                     |
       tour1.html            about.html           gallery.html
Run Code Online (Sandbox Code Playgroud)

我想将 about.html 页面链接到 tour1.html 页面。这可能吗?

我已经尝试了很多事情,但我无法弄清楚。我知道如果它在我可以使用的同一个文件夹中<a href="about.html">,如果它在根文件夹中我可以使用,<a href="..//about.html">但这些都不起作用。

html directory file parent hyperlink

0
推荐指数
1
解决办法
2万
查看次数

为什么?!cp:使用--parents,目标必须是目录

我有一个命令(有效,但脚本运行时所有内容都是从终端输出复制粘贴的):

cp --parents mcare.properties /mnt/hgfs/Shared-workspace/Release/CRMT-mcare/msite-binaries-UAT/mcare/WEB-INF/classes
Run Code Online (Sandbox Code Playgroud)

该命令由带有变量而不是文件名或目录的脚本执行,它看起来像这样(并且这个不起作用):

cp --parents $source $destination
Run Code Online (Sandbox Code Playgroud)

记录以查看每个变量中的内容:

source=mcare.properties
pwd:
/mnt/hgfs/Shared-workspace/Workspaces-CVS/Release-CRMT-mcare/mCare/config/UAT/home/wlp/mcare/WEB-INF/classes
total 16
-rwxrwxrwx. 1 root root  6724 Feb 29 19:50 activareCont.properties
drwxrwxrwx. 1 root root     0 Feb 29 20:10 CVS
-rwxrwxrwx. 1 root root  2333 Aug 25 17:55 externalpartner.properties
-rwxrwxrwx. 1 root root  1764 May 26 10:36 login.properties
-rwxrwxrwx. 1 root root 10068 Aug 25 17:55 mcare.properties
-rwxrwxrwx. 1 root root  8551 May 27 16:04 msite.properties
config/UAT/home/wlp/mcare/WEB-INF/classes/mcare.properties
UAT/home/wlp/mcare/WEB-INF/classes/mcare.properties
medium=UAT
/mnt/hgfs/Shared-workspace/Release/CRMT-mcare/msite-binaries-UAT/mcare/WEB-INF/classes
cp: with --parents, the destination must …
Run Code Online (Sandbox Code Playgroud)

directory bash parent cp

0
推荐指数
1
解决办法
9006
查看次数

C#:只有顶级控件才能拥有所有者。(地铁框架)

Only top-level controls can have an owner.即使我已经将子表单的顶层设置为 false,我也会收到此异常。

这是我的主要形式的代码:

    public Form childform;
    public void innerChild(Form child)
            {
                breaker();
                childform = child;
                childform.TopLevel = false;
                splitContainer1.Panel2.Controls.Add(childform);
                childform.Show(); //**Toplevel e**
            }

    private void breaker()
            {
                try
                {
                    childform.Close();
                    childform.Dispose();
                }
                catch { }
            }

     private void btnSupProd_Click(object sender, EventArgs e)
            {
                innerChild(new Supplier_Supplies(this));
}
Run Code Online (Sandbox Code Playgroud)

这是我的子表单中的相关代码:

MySqlConnection conn;
public Dashboard reftomain;
public Supplier_Supplies(Dashboard main)
        {
            InitializeComponent();
            reftomain = main;
            this.TopLevel = false;
            conn = new MySqlConnection("server=localhost; database=sample; uid=root; pwd=");
        }
Run Code Online (Sandbox Code Playgroud)

我试图让子窗体显示在我的主窗体的面板中。但是这个错误一直存在,有帮助吗?

堆栈跟踪: …

c# forms parent parent-child

0
推荐指数
1
解决办法
2081
查看次数