在使用使用java或android studio开发的Android应用程序时,我发现消息对话框提示会保持执行下一行,直到回答对话框提示。我一直在尝试使用TDialogService.MessageDialog(AMessage,ADialogType,AButtons,ADefaultButton,0,procedurexyz)来做到这一点。当显示提示时,执行下一行,使得提示无用,因为用户想要决定下一个操作。我需要任何人的帮助才能获得活动的阻止消息对话框提示。
答案 0 :(得分:1)
Embarcadero documentation says,在Android平台上,您只能使用针对MessageDialog
,myForm.ShowModal
,function myMessageDialog(const AMessage: string; const ADialogType: TMsgDlgType;
const AButtons: TMsgDlgButtons; const ADefaultButton: TMsgDlgBtn): Integer;
var
mr: TModalResult;
begin
mr:=mrNone;
// standart call with callback anonimous method
TDialogService.MessageDialog(AMessage, ADialogType, AButtons,
ADefaultButton, 0,
procedure (const AResult: TModalResult)
begin
mr:=AResult
end);
while mr = mrNone do // wait for modal result
Application.ProcessMessages;
Result:=mr;
end;
等的非阻止调用。
获得"阻止"模式,您可以使用解决方法,如下所示:
<script type="text/javascript" src="js/table.js"></script>
<?php include('auth.php');
error_reporting(0);
include("config.php");
ob_start();
include_once ('function.php');
$page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]);
$limit = 25;
$startpoint = ($page * $limit) - $limit;
if(strtolower(trim($type))=='new'){
$table = 'user_tbl';
}else{
$table = 'old_users';
}
$statement = "`$table` ";
?>
<section id="main">
<!-- <table width="817" class="example table-autopage:20 table-stripeclass:alternate" id="page">-->
<form name="bulk_action_form" action="dltaction.php" method="post" onSubmit="return delete_confirm();"/>
<table class="TFtable">
<thead>
<tr>
<th><input type="checkbox" name="select_all" id="select_all" value=""/> </th>
<th>Name<input name="filter" onkeyup="Table.filter(this,this)">
<br></th>
<th>Contact Number</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<?php
$stmt="SELECT * FROM (SELECT id, name, cont, email, 'new' as type FROM user_tbl UNION ALL SELECT id, name, cont, email, 'old' as type FROM old_users ) as t ORDER BY id DESC LIMIT {$startpoint} , {$limit}";
$result=mysqli_query($con , $stmt);
$count=0;
while($row=mysqli_fetch_array($result)) {
$count=$count+1;
$_SESSION['sess_type'] = $row['type'];
$_SESSION['sess_id'] = $row['id'];
?>
<tr>
<td align="center">
<input type="text" name="type" value="<?php echo $row['type']; ?>" hidden />
<input type="checkbox" name="checked_id[]" class="checkbox" value="<?php echo $row['id'].'_'.$row['type']; ?>"/></td>
<td><?php echo $row['name']; ?> <b>( <?php echo $row['type']; ?>) </b></td>
<td><?php echo $row['cont']; ?></td>
<td><?php echo $row['email']; ?></td>
<td><?php echo $row['apr']; ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<td colspan="9"><?php
echo pagination($statement,$limit,$page);
?> </td></tfoot>
</table>
<input type="submit" class="btn btn-danger" name="bulk_delete_submit" value="Delete"/>
</form>
</section>
答案 1 :(得分:1)
在你的建议@Kami之后,我想出了这个并且它对我来说非常好,但我愿意接受建议或补充。
function MsgBox(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
const ADefaultButton: TMsgDlgBtn ): Integer;
var
myAns: Integer;
IsDisplayed: Boolean;
begin
myAns := -1;
IsDisplayed := False;
While myAns = -1 do
Begin
if IsDisplayed = False then
TDialogService.MessageDialog(AMessage, ADialogType, AButtons, ADefaultButton, 0,
procedure (const AResult: TModalResult)
begin
myAns := AResult;
IsDisplayed := True;
end);
IsDisplayed := True;
Application.ProcessMessages;
End;
Result := myAns;
end;