精华内容
下载资源
问答
  • <div><h2>Purpose of this PR <p>This PR improves the dropdown widget documentation with some useful options which can be used on widget's initialization, also a good example which can be ...<ul><li>...
  • A Dialog Widget

    2020-12-02 11:25:08
    <div><p>Quite similar to the ... We can use the react dialog as a reference implementation - https://github.com/telerik/kendo-react-dialog</p>该提问来源于开源项目:telerik/kendo-ui-core</p></div>
  • Using the jQuery UI Dialog widget for confirmation windows In our web applications, we often have the need to confirm with the user whether or not they want to proceed with an action they att...

    Using the jQuery UI Dialog widget for confirmation windows


    In our web applications, we often have the need to confirm with the user whether or not they want to proceed with an action they attempted to take. For instance, we might have a delete button on our form that responds to a user click by deleting a record in the database. Before we actually do the delete, we want to double-check with the user first. JavaScript has a confirm(msg) function that will display a standard dialog window that you can use to determine whether or not to continue with an action. The standard dialog window looks like the following (in IE): 

    The standard confirm window is not very flexible. First, you only get two buttons (and no more), Ok and Cancel, and you can't change the text of either button. Second, you can't change the title on the title bar. You also can't change the question mark icon inside of the dialog. If you need something more flexible, you're going to have to create your own modal overlay window and recreate the functionality that confirm() gives you. Fortunately, jQuery UI has a dialog widget that will get you most of the way there:

     

    As you can see, this dialog window definitely doesn't look like the standard confirm. First, I have more than two buttons and with different text. I also have a different title. It can be resized and repositioned. Also, although you can't see it, this dialog window can have the same visual effects (like applying semi-transparent overlays on everything underneath the window) applied to it that can be applied to other html elements by using jQuery. This would not be possible with the standard confirm. I won't bore you with the details of how to set this up. The documentation on the jQuery site sufficiently explains that. What I want to concentrate on is showing you how to make the jQuery dialog widget behave exactly like the standard JavaScript confirm.

    When using the standard confirm, all processing stops until the user clicks on either Ok or Cancel in the window. That means that if the button was supposed to post back to the server, the postback won't occur until a selection is made. Usually, we only go ahead with the postback if the Ok button was clicked. This is typically handled by adding something similar to the OnClientClick event handler on our button:

    <asp:Button ID="Button1" runat="server" Text="JavaScript" OnClick="Click" OnClientClick="return confirm('Dude, are you sure?');" />

    If the user clicked the Ok button, true would be returned by the confirm(msg) function. If the user selected Cancel, false would be returned. Returning false in OnClientClick will effectively cancel the rest of the event processing (i.e., the event handler for the OnClick event won't be triggered).

    Now, for the jQuery dialog, this is how I have the button:

    <asp:Button ID="Button2" runat="server" Text="jQuery" OnClick="Click" OnClientClick="showjQueryDialog();return false;" />

    I call a client-side function showjQueryDialog() which, amazingly enough, handles showing my jQuery dialog (pre-configured in the document ready event handler). After the call to showjQueryDialog(), I go ahead and just return false. The reason why I have to return false here is because, unlike the confirm() function, the browser doesn't stop processing the rest of the client-side script just because the dialog widget is opened. So we have to manually stop it. Now this raises an issue. So if we always return false, how will our event handler for the OnClick event ever be executed? In order for that event handler to execute, we will need to do the postback ourselves. There are a couple of ways to handle this but this is the approach I take:

    1. Create a hidden field on the form (called hdnBtnPostback) who's value will be the exact postback function call I need to make in order to emulate the same postback that would occur had the button processing continued. This value can be set in the Page_Load() of the ASP.NET page. But how do we know what the exact postback function call should be? Fortunately for us, that is one of the methods available from the ClientScriptManager object. So the following code will do the trick:

     

    this.hdnBtnPostback.Value = Page.ClientScript.GetPostBackEventReference(Button2, string.Empty);

     

    This is will generate the exact same call to the __doPostBack() JavaScript function that is generated by the button. 

    2. In the event handler for my dialog's Ok button click, all I have to do then is get the value of this hidden field and pass it to the JavaScript eval() function. This will effectively execute the postback and the event handler for the OnClick event will be processed: 

        1    function showjQueryDialog() {

        2 

        3       $("#dialog").dialog("open");

        4    }

        5 

        6    //document on ready.

        7    $(function(){

        8       $("#dialog").dialog({

        9          autoOpen: false,

       10          modal:true,

       11          buttons : {

       12             "Yes" : function() {              

       13                $(this).dialog("close");

       14                eval($("#<%= hdnBtnPostback.ClientID %>").val());

       15             },

       16             "No" : function() {

       17                $(this).dialog("close");

       18             },

       19             "Maybe": function() {

       20                $(this).dialog("close");

       21                //what should we do when "Maybe" is clicked?

       22             }        

       23          }

       24       });

       25    });

    The event handler for the Yes button in the dialog are on lines 12-15. Line 14 is where we actually do the postback manually. 

    As you can see, it is quite easy to replace the standard confirm dialog and make it function in the same way. All that is needed is a little elbow grease :).

    转载于:https://www.cnblogs.com/robertfang/archive/2009/07/22/1528802.html

    展开全文
  • Show dialog on widget

    2018-11-08 16:43:08
    In flutter, we want to overlay a dialog above the widget. We were able to display the dialog after pushing the button. However, we want to display that dialog at the timing of displaying the widget ...

    In flutter, we want to overlay a dialog above the widget.

    We were able to display the dialog after pushing the button.

    However, we want to display that dialog at the timing of displaying the widget that likes loading dialog.

    We implemented as follows.

    import 'package:flutter/material.dart';
    
    class XxxxxWidget extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        // [NG]We want to show dialog on Container widget.
        // showMyDialog(context);
        return Container(
          child: FlatButton(
            child: Text('Show'),
            onPressed: () {
              // [OK]We can show dialog.
              showMyDialog(context);
            },
          ),
        );
      }
    
      void showMyDialog(BuildContext context) {
        showDialog<bool>(
          context: context,
          builder: (BuildContext context) {
            return AlertDialog(
              content: const Text(
                'Message',
              ),
              actions: <Widget>[
                FlatButton(
                  child: const Text('OK'),
                  onPressed: () {
                    Navigator.of(context).pop(true);
                  },
                ),
              ],
            );
          },
        );
      }
    }

    When we use [NG] code, the following error occurs.

    I/flutter (28618): When the exception was thrown, this was the stack:
    I/flutter (28618): #0      Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:3436:11)
    I/flutter (28618): #1      Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:3462:6)
    I/flutter (28618): #2      State.setState (package:flutter/src/widgets/framework.dart:1141:14)
    I/flutter (28618): #3      OverlayState.insertAll (package:flutter/src/widgets/overlay.dart:301:5)
    I/flutter (28618): #4      OverlayRoute.install (package:flutter/src/widgets/routes.dart:40:24)
    I/flutter (28618): #5      TransitionRoute.install (package:flutter/src/widgets/routes.dart:182:11)
    I/flutter (28618): #6      ModalRoute.install (package:flutter/src/widgets/routes.dart:740:11)
    I/flutter (28618): #7      NavigatorState.push (package:flutter/src/widgets/navigator.dart:1443:11)
    I/flutter (28618): #8      showDialog (package:flutter/src/material/dialog.dart:642:53)
    I/flutter (28618): #9      XxxxxWidget.showMyDialog (package:xxxxx/Widgets/xxxxx_widget.dart:20:5)
    I/flutter (28618): #10     XxxxxWidget.build (package:xxxxx/Widgets/xxxxx_widget.dart:7:5)
    [abridgement]

    We also tried FutureBuilder but could not solve this problem.

    How should we solve this problem?

    $ flutter doctor -v
    [✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.6 17G65, locale ja)
        • Flutter version 0.5.1 at /Applications/flutter
        • Framework revision c7ea3ca377 (3 months ago), 2018-05-29 21:07:33 +0200
        • Engine revision 1ed25ca7b7
        • Dart version 2.0.0-dev.58.0.flutter-f981f09760
    
    [✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
        • Android SDK at /Users/xxxxx/src/android-sdks
        • Android NDK at /Users/xxxxx/src/android-sdks/ndk-bundle
        • Platform android-27, build-tools 27.0.3
        • ANDROID_HOME = /Users/xxxxx/src/android-sdks
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
        • All Android licenses accepted.
    
    [✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 9.4.1, Build version 9F2000
        • ios-deploy 1.9.2
        • CocoaPods version 1.5.3
    
    [✓] Android Studio (version 3.1)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 27.1.1
        • Dart plugin version 173.4700
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    
    [!] VS Code (version 1.25.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension not installed; install from
          https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
    
    [✓] Connected devices (1 available)
        • ASUS Z017DA • XXXXXXXXXXXXXXX • android-arm64 • Android 8.0.0 (API 26)
    
    ! Doctor found issues in 1 category.

    We already installed Flutter extension. But flutter doctor said not installed. That is not important for this question.

     

     

    We have to display the dialog once done with building the widget. You can use Future.delayedfunction like below(I tested, it is working).

    class XxxxxWidget extends StatelessWidget {
    
    @override
    Widget build(BuildContext context) {
    // [NG]We want to show dialog on Container widget.
    
     Future.delayed(Duration.zero, () => showMyDialog(context)); // import 'dart:async';
     return Container(
      child: FlatButton(.... //same as question

    Explaination:

    As Dart is based on single-threaded event loop, when we create an async tasks, it will put those events in the end of the event queue and continue it's current execution. Please refer below example for more details,

    void main() {
      print("first");
      Future(() => print("second"));
      print("third");
      Future(() => print("forth"));

    }

    Output will be

    first
    third
    second
    forth

    It is very similar to

    DispatchQueue.main.async {
     print("Async1") //printJob
    }

    Once done with building the widget display the dialog. Check out my answer for similar problem.

    展开全文
  • dialog跳转widget问题

    2016-10-09 21:32:37
    这几天,一直被dialog登录界面跳转widget主界面的问题困扰,自己不断在网上找相似,和差不多的不断的尝试,都以失败告终,很痛苦的过程。   最后,我加了qq群,在群里面向大神们请教,最后终于解决了,在这谢谢@...

                  这几天,一直被dialog登录界面跳转widget主界面的问题困扰,自己不断在网上找相似,和差不多的不断的尝试,都以失败告终,很痛苦的过程。 

                 最后,我加了qq群,在群里面向大神们请教,最后终于解决了,在这谢谢@边缘~~~~,不管你能不能看到。

                 在这把我main函数,和.cpp的代码贴出来:

    main函数:

    #include "smartcar.h"
    #include <QApplication>
    
    
    
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
    
    
        SmartCar w;
        Logindlg login; //登陆界面
        if(login.exec()== QDialog::Accepted)
            {
                w.show();
                return a.exec();
            }
            else return 0;
    
    
    
    
    //    return a.exec();
    }
    
    

    .cpp代码:

    #include "logindlg.h"
    #include "Ui_logindlg.h"
    #include <QTextCodec>
    #include <QMessagebox>
    
    
    Logindlg::Logindlg(QWidget *parent):
         QDialog(parent),
         ui(new Ui::Logindlg)
    {
        ui->setupUi(this);
        setWindowFlags(Qt::FramelessWindowHint);
    
    
        connect(ui->loginButton,SIGNAL(clicked()),this,SLOT(on_loginButton_clicked()));
        connect(ui->cancelButton,SIGNAL(clicked()),this,SLOT(on_cancelButton_clicked()));
    }
    
    
    Logindlg::~Logindlg()
    {
        delete ui;
    }

    加红色的字体是添加的代码部分。













       


    展开全文
  • SimpleDialog A simple material design dialog.这是一种非常灵活的 Dialog 完全需要你根据自己的需求,来完成它的绘制。import 'package:flutter/material.dart'; class AVDialog ... Widget build(BuildCon...

    978b76eb7974ae50b7b18bddf0521eb9.png

    SimpleDialog

    A simple material design dialog.

    这是一种非常灵活的 Dialog 完全需要你根据自己的需求,来完成它的绘制。

    import 'package:flutter/material.dart';
    
    class AVDialog extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return new Scaffold(
          appBar: new AppBar(
            title: new Text('AVAlertDialog'),
          ),
          body: new RaisedButton(
            child: new Text('click me'),
            color: Colors.green,
            onPressed: (){
              showDialog(
                context: context,
                child: new SimpleDialog(
                  title: new Text('Hello icepy'),
                  children: <Widget>[
                    new Text('dialog children')
                  ],
                )
              );
            },
          ),
        );
      }
    }

    0e4a20b3d219e5a713a7f1efc9c76d1f.gif

    AlertDialog

    A material design alert dialog.

    顾名思义这是一种比 SimpleDialog 封装程度更高的 Dialog ,一般情况下如果你的用户需要完成确认这一项功能,那么使用它会比较迅速。

    import 'package:flutter/material.dart';
    
    class AVDialog extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return new Scaffold(
          appBar: new AppBar(
            title: new Text('AVDialog'),
          ),
          body: new RaisedButton(
            child: new Text('click me'),
            color: Colors.green,
            onPressed: (){
              showDialog(
                context: context,
                child: new AlertDialog(
                  title: new Text('alert'),
                  actions: <Widget>[
                    new FlatButton(
                      child: new Text('确定'),
                      onPressed: (){
                        Navigator.pop(context);
                      },
                    )
                  ],
                )
              );
            },
          ),
        );
      }
    }

    2eb05d84ec3acbcc1472e729e1ec27a9.gif

    AboutDialog

    An about box. This is a dialog box with the application's icon, name, version number, and copyright, plus a button to show licenses for software used by the application.

    这个 Widget 一般来说不是很常用,只用于显示应用,如图:

    dd246478a254c7432531a806fd91ff46.gif
    import 'package:flutter/material.dart';
    
    class AVDialog extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return new Scaffold(
          appBar: new AppBar(
            title: new Text('AVDialog'),
          ),
          body: new RaisedButton(
            child: new Text('click me'),
            color: Colors.green,
            onPressed: (){
              showDialog(
                context: context,
                child: new AboutDialog(
                  applicationName: 'Flutter',
                  applicationVersion: 'v1.0.0',
                  applicationIcon: new Icon(
                    Icons.android,
                    color: Colors.green,
                  ),
                  children: <Widget>[
                    new Text(
                      '更新摘要 n Update 1.0.0'
                    )
                  ],
                )
              );
            },
          ),
        );
      }
    }
    展开全文
  • 2、widgetdialog都有show函数,如果通过这个函数显示这两种类型的窗口,则两个窗口都是可选的; 3、widget主要是在上面放置布局和控件; 4、mainwindow可以显示菜单,工具栏,状态栏、托盘等功能。 QMainWindow...
  • QTwidget,MainWindow和Dialog的选择使用Qt中的每个类,都有一个对应的同名头文件,其中包含其类定义。例如要使用QApplication类,则需要在程序中添加"#include"QApplication类用于管理应用程序范围内的资源。其构造...
  • Qt的三大窗口dialogwidget、mainwindow

    千次阅读 2018-09-21 20:51:07
    一、dialogwidget、mainwindow的区别  1)、dialog有exec函数,如果是dialog窗口,后边的窗口时不可选的;  2)、widgetdialog都有show函数,如果通过这个函数显示这两种类型的窗口,则两个窗口都是可选的; ...
  • dialogwidget、mainwindow的区别 1. dialog有exec函数,如果是dialog窗口,后边的窗口时不可选的; 2. widgetdialog都有show函数,如果通过这个函数显示这两种类型的窗口,则两个窗口都是可选的; 3. widget...
  • dialogwidget、mainwindow的区别 1)、dialog有exec函数,如果是dialog窗口,后边的窗口时不可选的; 2)、widgetdialog都有show函数,如果通过这个函数显示这两种类型的窗口,则两个窗口都是可选的; 3)、...
  • 一dialogwidgetmainwindow的区别一、dialogwidget、mainwindow的区别 1)、dialog有exec函数,如果是dialog窗口,后边的窗口时不可选的; 2)、widgetdialog都有show函数,如果通过这个函数显示这两种类型的...
  • 1/13Qt中的每个类,都有一个对应的同名头文件,其中包含其类定义。例如要使用QApplication类,则需要在程序中添加"#include"QApplication类用于管理应用程序范围内的...widget中可容纳其它widget。Qt中的widget在...
  • <div><p>该提问来源于开源项目:mcallegari/qlcplus</p></div>
  • <p>The dialog promo is shown to the user if Stats are loaded fine, and the Stats Widget is not already used by the user, when Stats are loaded for the 3rd, 1,000th, or 10,000th, time.</p><p>该提问来源...
  • widget主要是在上面放置布局和控件;所有用户界面对象的基类。 窗口部件是用户界面的一个基本单元:它从窗口系统接收鼠标、键盘和其它事件,并且在屏幕上绘制自己。每一个窗口部件都是矩形的,并且它们按Z轴顺序排列...
  • 分为search dialog和search widget 区别: A,search dialog是一个被系统控制的UI组件。但他被用户激活的时候,它总是出现在activity的上。 B,Android系统负责处理search dialog上所有的事件,当用户提交了查询,...
  • <div><p>When we use the widget inside a jQuery UI Dialog and the dropdown is longer than the dialog's height, the dialog creates scrollbars. Scrolling the dialog makes the popup disappear. Also, ...
  • <div><p>Currently the Edit Widget Properties dialog looks like this <p><img alt="capture d ecran 2016-11-16 a 12 53 26" src=...
  • 匿名用户1级2014-12-18 回答Qt中的每个类,都有一个对应的同名头文件,其中包含其类定义。例如要使用QApplication类,则需要在程序中添加" #include "QApplication类用于管理应用程序范围内...widget中可容纳其它wid...
  • <div><h2>Description <p>This PR is the following of #31951 ...src=...<p><img alt="feature_selection_dialog" src="https://img-blog.csdnimg.cn/img_convert/781162e287f22e749e68dc9362fa9147.gif" /></p> ...
  • <div><p>This adds a modal dialog for selecting a path graphically. The dialog returns a model id that can be a collection, user, folder, or item. For a usage example, I added a button to the <code>...
  • 1.Dialog\widget\ mainwindow的区别 注意mainwindow和widget的区别,mainwindow都工具栏和菜单栏 Dialog and mainwinodws 都是继承与 Widget。 布局管理器 & 分裂器的区别 左边为布局管理器,右边为...
  • Adds embedded find/replace dialog into the editor widget. To trigger press <code>Ctrl+F</code>. <p>Also fixes the editor widgets (and children) being leaked. <p><strong>To test: - Press CTRL+F...
  • Qt中的每个类,都有一个对应的同名头文件,其中包含其类定义。例如要使用QApplication类,则需要在程序中添加" #include "  QApplication类用于管理应用程序范围内的资源。...widget中可容纳其它widget
  • QT中 widget window dialog 的区别

    千次阅读 2017-07-04 11:16:51
    A widget is an object that can be displayed on the screen. For example a window or a button...A dialog is a top-level widget, that is always displayed in separate window (i.e. you can’t put it on anothe
  • Widget翻译过来是小部件的意思,WidgetDialog和MainWindow三者都可以独立创建用户界面。QWidget类是所有用户界面对象的基类,QMainWindow和QDialog其实就是QWidget的子类,唯一有点血缘关系的就是继承了QWidget类...
  • <div><p>该提问来源于开源项目:ccrama/Slide</p></div>

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 2,117
精华内容 846
关键字:

dialogwidget