小编Jon*_*Jon的帖子

MFC确定/取消对话框按钮覆盖?

语言: C++

开发环境: Microsoft Visual C++

使用的库: MFC

MFC很新,所以请耐心等待.我有一个通过DoModal()启动的对话框.我正在尝试向此对话框添加按钮,以取代默认的"确定"和"取消"按钮.现在,我无法弄清楚如何做到这一点.我删除了"确定"和"取消"按钮,并添加了新的ID,添加了事件处理程序,以及一些简单的代码,以便在按下时执行,但我无法使其工作.

我怀疑它与DoModal()期望OK或Cancel的响应这一事实有关,但没有别的.我不是很确定.任何帮助将不胜感激!

编辑:剥离代码添加供参考.

void CPrefsDlg::Launch() {

[ ... ]

  CSAPrefsDialog dlg;

  INT_PTR nRet = -1;
  nRet = dlg.DoModal();

  // Handle the return value from DoModal
  switch ( nRet )
  {
  case -1: 
     AfxMessageBox("Dialog box could not be created!");
     break;
  case IDABORT:
     // Do something
     break;
  case IDOK: // This works just fine.
     exit(0);
     break;
  case IDSAVEONE: // This does not work.
     MessageBox("Save One");
     break;
  default:
     break;
  };
}

void CPrefsDlg::SaveOne()
{
// …
Run Code Online (Sandbox Code Playgroud)

c++ mfc button

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

具有自动高度的CSS3翻转卡

我正在使用一个教程来创建一个使用CSS3和jQuery的翻转卡效果,并且我在调整内容长度时遇到问题,同时让它仍然在中心水平上翻转.

小提琴.

码:

<div class="flip"> 
    <div class="card"> 
        <div class="face front"> 
            Front<br> Other text.<br> Other text.<br> Other text.<br> Other text.
        </div> 

        <div class="face back"> 
            Back
        </div> 
    </div> 
</div> 
Run Code Online (Sandbox Code Playgroud)
body {
 background: #ccc;   
}
.flip {
  -webkit-perspective: 800;
   width: 400px;
   height: 200px;
    position: relative;
    margin: 50px auto;
}
.flip .card.flipped {
  -webkit-transform: rotatex(-180deg);
}
.flip .card {
  width: 100%;
  height: 100%;
  -webkit-transform-style: preserve-3d;
  -webkit-transition: 0.5s;
}
.flip .card .face {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-backface-visibility: hidden ;
  z-index: 2;
    font-family: …
Run Code Online (Sandbox Code Playgroud)

css jquery height css3

2
推荐指数
2
解决办法
8179
查看次数

jQuery可排序(Drag-n-Drop)仪表板容器

场景:

我正在尝试创建一个各种各样的小部件的仪表板.我希望用户能够根据自己的喜好安排自己的小部件.

我一直在尝试使用portlets示例实现jQuery UI的可排序交互,但我遇到了一些麻烦.

在此输入图像描述

什么工作:

我可以在同一行的列之间拖放/重新排列容器.

什么不工作:

我无法在行之间拖动容器.

我的问题:

如何在行列之间启用拖放操作?

jsFiddle演示:

http://jsfiddle.net/SWUTR/


相关HTML:

<div class="column">
    <div class="container span2"></div>
    <div class="container span2"></div>
</div>
<div class="column">
    <div class="container span1"></div>
    <div class="container span2"></div>
    <div class="container span1"></div>
</div>
<div class="column">
    <div class="container span4"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

相关CSS:

.column .container {
    float:left;
    margin:5px;
    min-width:100px;
    height:250px;
    background:#39F;    
}
    .column .container.span1 {
        width:calc(25% - 10px); 
        background:#6CC;
    }
    .column .container.span2 {
        width:calc(50% - 10px); 
        background:#6F6;
    }
    .column .container.span3 {
        width:calc(75% - 10px); 
        background:#99C;
    } …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery jquery-ui jquery-ui-sortable

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

使用随机数据生成 JSON

我正在使用opportunity.js来帮助我生成一些随机数据。它运行得非常好,我想使用这些数据来输出随机 JSON 对象。

这是我想要的结构:

{
    "users": [
        {
            "Name": "John Smith",
            "Fname": "John",
            "Lname": "Smith",
            "Email": "john.smith@acmemedia.com", 
        }, 

        ...etc
}
Run Code Online (Sandbox Code Playgroud)

我有opportunity.js在 jsFiddle 中工作,但我不确定如何使用chance.js函数输出 JSON 数据。

$(function() {    
    $("div[data]").each(function() {
        var data = $(this).attr("data");
        var chance = new Chance(Math.Random);
        $(this).append(chance[data]());
    });
});
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/5Lcfz838/4/

opportunity.js 文档可在此处获取: http: //chancejs.com/

javascript jquery json

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

页面加载时多个AJAX调用

我试图从外部源中提取两个单独的东西,放到我正在创建的HTML页面上.我有一个成功的AJAX函数,通过解析该频道的XML/RSS提要,从特定的Youtube频道中提取最新视频.我通过AJAX调用收到了这个feed.

我还希望从Blogger帐户中获取最新的博文.解析feed以获取最新条目的代码应该不难,但我在同时进行AJAX调用时遇到问题.我在某处读到它一次只能处理一个?我对排队他们感到厌倦,因为我不希望页面上的内容按步骤加载.我宁愿这一切都只是同时获取.我该怎么做呢?

这是我目前的脚本:

<script type="text/javascript" charset="utf-8">
    $(function() {
      $.ajax({
        type: "GET",
        url: "http://gdata.youtube.com/feeds/base/users/devinsupertramp/uploads?orderby=updated&alt=rss&client=ytapi-youtube-rss-redirect&v=2",
        dataType: "xml",
        success: parseXml
      });
    });

    function parseXml(xml) {
        $(xml).find("item:first").each(
            function() {
                var tmp = $(this).find("link:first").text();
                tmp = tmp.replace("http://www.youtube.com/watch?v=", "");
                tmp = tmp.replace("&feature=youtube_gdata", "");
                var tmp2 = "http://www.youtube.com/embed/" + tmp + "?autoplay=1&controls=0&rel=0&showinfo=0&autohide=1";
                var iframe = $("#ytplayer");
                $(iframe).attr('src', tmp2);
            }
        );
    }
</script>
Run Code Online (Sandbox Code Playgroud)

ajax jquery request

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

Chrome中<input>的动态重新调整失败(适用于IE/Firefox)

我有一个输入框,当更改其左侧的过滤器时,它会动态地重新调整大小以显示相同的长度.

我有一些jQuery,每次用户从下拉列表更改过滤器时计算宽度偏移量.它在IE和Firefox中正常工作.但由于某种原因,它在Chrome中失败并继续缩小输入框.

知道为什么会这样吗?

这是一个实时版本.

这是重新调整大小的代码:

$('#refineDropdown li').click(function() {
        var tmp = $('#refine').width();
        $('#refine').html($(this).text()); // sets the text of the button to the new selection
        $('#refine').removeClass('refineClicked'); // temp css restyling
        $("#refineDropdown").hide(); // hides the dropdown
        testLength(); // adjusts the width of the input box suggestions drop down
        $('#search').css('width', $('#search').width() + (tmp - $('#refine').width())); // calculates the new width offset and makes the adjustment
    });

function testLength() {
        if ($('#refine').text().length > 7) {
            $('#refine').html($('#refine').text().substring(0, 6) + "...");
        }
        $('#dropdown').css('width', $('#search').width() + 1); …
Run Code Online (Sandbox Code Playgroud)

html jquery resize

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

在JQuery .post期间丢失变量值

我正在尝试使用.post将一些数据传递给PHP文件,但是在这个过程的某个地方,我传递的字符串的值丢失了,我收到的是NULL.

这是脚本:

<script type="text/javascript">
    $("select").change(function () {
        var tmp = "";
        $("select option:selected").each(function () {
            tmp = $(this).text();
        });
        $(".title").text(tmp);

        $.ajax({
            url:"php/description.php",
            type:"POST",
            data: { major:tmp },
            success: function(result) {
            alert(result);
            }
        });       
    });
</script>
Run Code Online (Sandbox Code Playgroud)

我正在测试它的简单PHP文件.

<?php
    $major = empty($_POST['tmp']);
    echo $major;
?>
Run Code Online (Sandbox Code Playgroud)

当用户单击选择列表中的新选项/项时,将调用它.脚本的顶部正常工作(只需获取他们点击的内容的值并将其放在页面上的某个位置),但post方法不起作用.它警告NULL.我找不到问题.

ajax jquery http-post

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

标签 统计

jquery ×6

ajax ×2

html ×2

javascript ×2

button ×1

c++ ×1

css ×1

css3 ×1

height ×1

http-post ×1

jquery-ui ×1

jquery-ui-sortable ×1

json ×1

mfc ×1

request ×1

resize ×1