小编Hei*_*inz的帖子

从Delphi XE调用Delphi 7 DLL

我需要在Delphi 7中包含一些遗留代码,以便在Delphi XE2中使用.我的问题似乎很简单,但我尝试了所有我能找到的例子,但都失败了.基本上,我需要能够D7和DXE2之间传递一个字符串,而据我可以计算出,最安全的方法是使用PChar类型(因为我不想出货borlandmm DLL).所以用D7编写的DLL,由Delphi XE2调用

我的界面需要

在我的DLL中:

function d7zipFile(pFatFile,pThinFile : PChar) : integer; stdCall;
function d7unzipfile(pThinFile,pFatFile : PChar) : integer; stdCall;
Run Code Online (Sandbox Code Playgroud)

我需要在unzipfile函数中传递BACK pFatFile名称.

在我的调用代码中:

function d7zipFile(pFatFile,pThinFile : PChar) : integer; external 'd7b64zip.dll';

function d7unzipfile(pThinFile,pFatFile : PChar) : integer; external 'd7b64zip.dll';
Run Code Online (Sandbox Code Playgroud)

有人可以帮助您实施这些最好的方法吗?

显然我不是在寻找实际的zip/unzip代码 - 我在D7中工作得很好.我想知道如何声明和使用字符串/ pchar参数,因为我尝试的各种类型(PWideChar,WideString,ShortString等)都给出了错误.

因此,我很乐意能够在d7zipFile函数中为两个文件名执行showMessage.然后能够在pFatFile变量上的delphiXE2中执行showMessage,这意味着字符串双向都可以吗?

delphi dll interface delphi-7 delphi-xe2

3
推荐指数
1
解决办法
2872
查看次数

Laravel Nova:将字段动态绑定到模型上的 JSON 属性

拉拉维尔·诺瓦

对于特定项目,我想结合使用 Nova Resource UI 的强大功能和更灵活的数据模型。具体来说,我希望能够将字段添加到存储在 JSON 数据库字段中而不是表中的属性的资源中。

规格:

数据库模型:报价(含迁移)

public function up()
{
    Schema::create('quotations', function(Blueprint $table)
    {
        $table->bigInteger('id', true);
        $table->timestamps();
        $table->string('client_name', 100)->nullable();
        $table->string('client_surname', 100)->nullable();
        $table->string('status', 10)->nullable()->default('NEW');
        $table->text('data')->nullable();
    });
}
Run Code Online (Sandbox Code Playgroud)

新星资源

因此,我可以定义一个“正常”NOVA 资源,并在 App\Nova\Quotation 中定义以下字段(*忽略状态):

public function fields(Request $request)
{
    return [
        Text::make('Client Name')->sortable(),
        Text::make('Client Surname')->sortable(),


    ];
}
Run Code Online (Sandbox Code Playgroud)

现在我的“愿望”是达到这种效果,使用不存在的“bindTo”方法来说明我想要实现的目标

public function fields(Request $request)
{
    return [
        Text::make('Client Name')->sortable(),
        Text::make('Client Surname')->sortable(),

        //Fields bound into the JSON data property  
        Text::make('Client Id')->bindTo('data.client_id),
        Date::make('Client Date Of Birth')->bindTo('data.client_date_of_birth),

        //etc       


    ];
}
Run Code Online (Sandbox Code Playgroud)

因此,当保存报价模型时,client_name 和 …

laravel eloquent laravel-nova

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