Alert replacement is intresting
Will be part of replacement library with achoice dbedit replacement

2009/4/15 Vailton Renato <[email protected]>:
> Hi Pritpal!
>
> I have followed their work using hbQt and I think it is great!
> In my personal tests here, I developed a  ALERT() function ... I would
> send you in the hope of contributing to the project, I will be
> grateful if you can consider:
>
> #include <QMessageBox>
>
> /*
>  * ALERT() function basead on QT MessageBox. By Vailton Renato
> <[email protected]>
>  * Syntax: Alert( <xText>, [<aOptions>|<cOption>], [<xTitle>],
> [<nIcon>] ) -> nSelectedOption
>  * 15/04/2009 - 09:47:01
>  */
> HB_FUNC( ALERT )
> {
>  QString text;
>  QMessageBox  msgBox;
>  QList<QAbstractButton *> btnList;
>
>  char *szText;
>  PHB_ITEM pItem;
>  BOOL fFree;
>  ULONG ulSize, ulLen, ul;
>
>  /* Text of window .. */
>  if (!HB_ISNIL(1))
>  {
>   szText = hb_itemString( hb_param( 1, HB_IT_ANY ), &ulLen, &fFree );
>   if (ulLen)
>     text.append( szText );
>   if( fFree )
>     hb_xfree( szText );
>  }
>
>  if (text.isEmpty())
>  {
>   hb_retni(0);
>   return;
>  }
>
>  text.replace( ';', '\n' );
>
>  if (ISARRAY(2))
>  {
>   pItem  = hb_param( 2, HB_IT_ARRAY );
>   ulSize = hb_arrayLen( pItem );
>
>   for( ul = 1; ul <= ulSize; ++ul )
>   {
>      szText = hb_itemString( hb_arrayGetItemPtr( pItem, ul ), &ulLen,
> &fFree );
>      if (ulLen)
>         btnList << msgBox.addButton( szText, QMessageBox::ActionRole );
>      if( fFree )
>         hb_xfree( szText );
>   }
>  } else {
>   if (!HB_ISNIL(2))
>   {
>      szText = hb_itemString( hb_param( 2, HB_IT_ANY ), &ulLen, &fFree );
>
>      if (ulLen)
>         btnList << msgBox.addButton( szText, QMessageBox::ActionRole );
>      if( fFree )
>         hb_xfree( szText );
>   }
>  }
>
>  if (btnList.isEmpty())
>    btnList << msgBox.addButton( QMessageBox::Ok );
>
>  /* Title of window */
>  if (!HB_ISNIL(3))
>  {
>   szText = hb_itemString( hb_param( 3, HB_IT_ANY ), &ulLen, &fFree );
>   if (ulLen)
>      msgBox.setWindowTitle( szText );
>   if( fFree )
>      hb_xfree( szText );
>  }
>
>  if (ISNUM(4))
>  {
>   int nIcon = hb_parni(4);
>
>   if ((nIcon >= 0) && (nIcon <= 4 ))
>      msgBox.setIcon( QMessageBox::Icon( nIcon ) );
>  }
>
>  msgBox.setTextFormat( Qt::PlainText );
>  msgBox.setText( text );
>  msgBox.exec();
>
>  hb_retni( btnList.indexOf( msgBox.clickedButton() ) +1 );
> }
>
>
> I would appreciate any comments!
>
> Best regards,
> Vailton Renato
> _______________________________________________
> Harbour mailing list
> [email protected]
> http://lists.harbour-project.org/mailman/listinfo/harbour
>

-- 
Massimo Belgrano
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to