DELPHI XE5-8 弹出列表框供选择

 

 

点击章节练习:

var
 tmplm:Tlistboxitem;
begin
  dm.FDQTMP.SQL.Clear;
  dm.FDQTMP.SQL.Add('select GSESSON from TSquestions where GLESSON=:ggl group by GSESSON');
  dm.FDQTMP.Params.ParamByName('ggl').Value:=Qlesson;
  dm.FDQTMP.Open;
  dm.FDQTMP.First;
  ListBoxSesson.Items.Clear;
  ListBoxSesson.BeginUpdate;
  while not dm.FDQTMP.Eof do
   begin
     tmplm:=Tlistboxitem.Create(nil);
     tmplm.ItemData.Text:=dm.FDQTMP.FieldByName('GSESSON').AsString;
     tmplm.ItemData.Bitmap:=ImageYuan.Bitmap;
     tmplm.Parent:=ListBoxSesson;
     dm.FDQTMP.Next;
   end;
   ListBoxSesson.EndUpdate;
   popsesson.PlacementTarget:=Imagetop;
   popsesson.Placement:=TPlacement.plBottomCenter;
   popsesson.IsOpen:=true;

  

procedure TFmode.ListBoxSessonChange(Sender: TObject);
begin  //选择章节
    Qsesson:=ListBoxSesson.Items[ListBoxSesson.ItemIndex] ;
    popsesson.IsOpen:=false;
    if length(Qsesson)<>0 then
     begin
       Application.CreateForm(TFAnsOne, FAnsOne);
       {$IFDEF Android}
        FAnsOne.show;
      {$ENDIF}
       {$IFDEF IOS}
        SHOWMESSAGE('下面开始第'+Qsesson+'章练习');
        FAnsOne.show;
      {$ENDIF}
      {$IFDEF MSWINDOWS}
        FAnsOne.showmodal;
       {$ENDIF}
     end;

end;

  

 

posted @ 2015-05-16 08:44 happyhills 阅读(...) 评论(...) 编辑 收藏