Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Need help on xbasic calculator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need help on xbasic calculator

    The plus sing works fine
    1+1=2+2=4+5=9
    The minus sign works fine
    The divide sign works fine

    The * or multiply sign fails
    Any help would be appreciated.

    Thanks
    Charlie Crimmel

    xbasic code is below
    'Date Created: 11-May-2010 06:59:09 AM
    'Last Updated: 14-May-2010 05:15:15 PM
    'Created By : charlie
    'Updated By : charlie
    trace.clear()
    dim global base as C
    dim global base1 as C
    dim global result as C

    var->base = ""
    var->base1 = ""
    var->result = ""

    ui_modeless_dlg_box("vn",<<%dlg%
    {xmargin=2}
    {ymargin=1}
    {nocaption}
    {font=a,10,b}
    {color=white on white}

    {font=a,25,b}
    [.70 base];

    {font=a,28,b}
    {style}
    $Button {
    font:Arial,15,b;
    border-shape:SMALL-rounded;
    line-style:single;
    line-width:1;
    line-color:light blue;
    fill-style:Gradient Horizontal Top;
    fill-color:Pale blue;fill-accent-color:white;
    }
    $Button:hover,$Button:focused {
    font:Arial,18,B;
    border-shape:small-rounded;
    line-style:single;
    line-width:1;
    line-color:blue;
    fill-style:Gradient horizontal;
    fill-color:Green;
    fill-accent-color:White;}
    }
    $frame {
    fill-style:Gradient horizontal;
    fill-color:White;
    fill-accent-color:light Blue;
    }
    {endstyle};
    {color=black on white}
    <15,5 1!1><15,5 2!2><15,5 3!3> <15,5+!+>;
    <15,5 4!4><15,5 5!5><15,5 6!6> <15,5-!->;
    <15,5 7!7><15,5 8!8><15,5 9!9> <15,5*!*>;
    <15,5 .!.><15,5 0!0>
    {font=a,15,b}
    <15,5 Clear!clear> <15,5/!/>;
    {font=a,15,b}
    <15,5 OK!OK><15,5Cancel!Cancel><15,5 Reset!reset> <15,5=!>;
    %dlg%,<<%code%
    if a_dlg_button="clear" then
    var->base = ""
    var->base1 = ""
    end if
    if a_dlg_button="reset" then
    var->base = ""
    var->base1 = ""
    end if
    if a_dlg_button="Cancel" then
    var->base = ""
    var->base1 = ""
    ui_modeless_dlg_close("VN")
    end if
    if a_dlg_button="OK" then
    var->base = ""
    var->base1 = ""
    ui_modeless_dlg_close("VN")
    end if

    if a_dlg_button="." then
    'Update value in existing variable 'base' to '=Var->base+"."
    base = convert_type(a5_eval_expression("=Var->base+\".\""),"C")
    trace.WriteLn("Pressed Number .")
    end if

    if a_dlg_button="1" then
    'Update value in existing variable 'base' to '=Var->base+"1"
    base = convert_type(a5_eval_expression("=Var->base+\"1\""),"C")
    trace.WriteLn("Pressed Number 1")
    end if

    if a_dlg_button="2" then
    'Update value in existing variable 'base' to '=Var->base+"2"
    base = convert_type(a5_eval_expression("=Var->base+\"2\""),"C")
    trace.WriteLn("Pressed Number 2")
    end if

    if a_dlg_button="3" then
    'Update value in existing variable 'base' to '=Var->base+"3"
    base = convert_type(a5_eval_expression("=Var->base+\"3\""),"C")
    trace.WriteLn("Pressed Number 3")
    end if

    if a_dlg_button="4" then
    'Update value in existing variable 'base' to '=Var->base+"4"
    base = convert_type(a5_eval_expression("=Var->base+\"4\""),"C")
    trace.WriteLn("Pressed Number 4")
    end if

    if a_dlg_button="5" then
    'Update value in existing variable 'base' to '=Var->base+"5"
    base = convert_type(a5_eval_expression("=Var->base+\"5\""),"C")
    trace.WriteLn("Pressed Number 5")
    end if

    if a_dlg_button="6" then
    'Update value in existing variable 'base' to '=Var->base+"6"
    base = convert_type(a5_eval_expression("=Var->base+\"6\""),"C")
    trace.WriteLn("Pressed Number 6")
    end if

    if a_dlg_button="7" then
    'Update value in existing variable 'base' to '=Var->base+"7"
    base = convert_type(a5_eval_expression("=Var->base+\"7\""),"C")
    trace.WriteLn("Pressed Number 7")
    end if

    if a_dlg_button="8" then
    'Update value in existing variable 'base' to '=Var->base+"8"
    base = convert_type(a5_eval_expression("=Var->base+\"8\""),"C")
    trace.WriteLn("Pressed Number 8")
    end if

    if a_dlg_button="9" then
    'Update value in existing variable 'base' to '=Var->base+"9"
    base = convert_type(a5_eval_expression("=Var->base+\"9\""),"C")
    trace.WriteLn("Pressed Number 9")
    end if

    if a_dlg_button="0" then
    'Update value in existing variable 'base' to '=Var->base+"0"
    base = convert_type(a5_eval_expression("=Var->base+\"0\""),"C")
    trace.WriteLn("Pressed Number 0")
    end if

    if a_dlg_button="+" then
    base1 = convert_type(a5_eval_expression("=Var->base"),"C")
    'Update value in existing variable 'result' to '1
    result = "1"
    'Clear fields 'Base' in current form.
    Base = ""
    trace.WriteLn("Pressed Number +")
    end if

    if a_dlg_button="-" then
    'Update value in existing variable 'base1' to '=Var->base
    base1 = convert_type(a5_eval_expression("=Var->base"),"C")
    'Update value in existing variable 'result' to '2
    result = "2"
    'Clear fields 'Base' in current form.
    Base = ""
    trace.WriteLn("Pressed Number -")
    end if

    if a_dlg_button="*" then
    base1 = convert_type(a5_eval_expression("=Var->base"),"C")
    'Update value in existing variable 'result' to '3
    result = "3"
    'Clear fields 'Base' in current form.
    Base = ""
    trace.WriteLn("Pressed Number *")
    end if


    if a_dlg_button="/" then
    'Update value in existing variable 'base1' to '=Var->base
    base1 = convert_type(a5_eval_expression("=Var->base"),"C")
    'Update value in existing variable 'result' to '4
    result = "4"
    'Clear fields 'Base' in current form.
    Base = ""
    trace.WriteLn("Pressed Number /")
    end if

    if a_dlg_button="=" then
    'Conditional code follows. Executes only if the condition expression is True.
    IF Var->result = "1" THEN
    'Update value in existing variable 'base' to '=str(val(Var->base1)+val(base),10,2)
    base = convert_type(a5_eval_expression("=str(val(Var->base1)+val(base),10,2)"),"C")
    END IF

    'Conditional code follows. Executes only if the condition expression is True.
    IF Var->result = "2" THEN
    'Update value in existing variable 'base' to '=str(val(Var->base1)-val(base),10,2)
    base = convert_type(a5_eval_expression("=str(val(Var->base1)-val(base),10,2)"),"C")
    END IF

    'Conditional code follows. Executes only if the condition expression is True.
    IF Var->result = "3" THEN
    'Update value in existing variable 'base' to '=str(val(Var->base1)*val(base),10,2)
    base = convert_type(a5_eval_expression("=str(val(Var->base1)*val(base),10,2)"),"C")
    END IF

    'Conditional code follows. Executes only if the condition expression is True.
    IF Var->result = "4" THEN
    'Update value in existing variable 'base' to '=str(val(Var->base1)/val(base),10,2)
    base = convert_type(a5_eval_expression("=str(val(Var->base1)/val(base),10,2)"),"C")
    END IF
    trace.WriteLn("Pressed Number =")

    end if

    %code%)

    #2
    Re: Need help on xbasic calculator

    Here you have it. This will give you a popup calculator. Add cosmetics.
    I did not code for the OK button, you need to place the value wherever you want. Maybe something like:
    this.value=val(base)
    Code:
    dim global base as C=""
    dim global base1 as C=""
    dim global result as C
    dim vop as n=0
    ui_modeless_dlg_box("vn",<<%dlg%
    {xmargin=2}
    {ymargin=1}
    {nocaption}
    
    {font=a,15,b}
    [.70 base];
    {font=a,28,b}
    <15,5 1!x1><15,5 2!x2><15,5 3!x3> <15,5+!+a>;
    <15,5 4!x4><15,5 5!x5><15,5 6!x6> <15,5-!-a>;
    <15,5 7!x7><15,5 8!x8><15,5 9!x9> <15,5*!*a>;
    <15,5 .!x.><15,5 0!x0>
    {font=a,15,b}
    <15,5 Clear!clear> <15,5/!da>;
    {font=a,15,b}
    <15,5 OK!OK><15,5Cancel!Cancel><15,5 Reset!reset> <15,5=!>;
    %dlg%,<<%code%
    select
    	case left(a_dlg_button,1)="x"
    	base=base+right(a_dlg_button,1)
        case a_dlg_button="clear"
    	base = left(base,len(base)-1)
    	case a_dlg_button="Reset"
    	base=""
    	case a_dlg_button="cancel"
    	ui_modeless_dlg_close("vn")
    end select
    if right(a_dlg_button,1)="a"
    	base1=base
    	base=""
    select
        case left(a_dlg_button,1) ="+"
        vop=1
        case left(a_dlg_button,1) ="-"
        vop=2
        case left(a_dlg_button,1) ="*"
        vop=3
        case left(a_dlg_button,1) ="d"
        vop=4       
    end select
    end if
    if a_dlg_button="="
    select
        case vop=1
        base=ltrim(str(val(base)+val(base1),70,2))
        case vop=2
        base=ltrim(str(val(base1)-val(base),70,2))
        case vop=3
        base=ltrim(str(val(base)*val(base1),70,2))
        case vop=4
        base=ltrim(str(val(base1)/val(base),70,2))
    end select
    end if
    %code%)

    Comment


      #3
      Re: Need help on xbasic calculator

      Slightly better version for popup:
      Code:
      dim global base as C=""
      dim global base1 as C=""
      dim global result as C
      dim vop as n=0
      ui_modeless_dlg_box("vn",<<%dlg%
      {xmargin=2}
      {ymargin=.1}
      {nocaption}
      {region0}
      {font=a,10,b}
      {region1}{font=a,14,b}{ypad=2}{lf=4};[.27,2 base]{endregion1}{font=a,7}|{region2}{ypad=1}{lf};{ypad=.1}Decimal;[%z;s1,10%.6spin]{endregion2};
      {endregion0};
      {font=a,12,b}<7,2 1!x1><7,2 2!x2><7,2 3!x3>{font=a,22,b}<7,2+!+a>;
      {font=a,12,b}<7,2 4!x7><7,2 5!x2><7,2 6!x6>{font=a,22,b}<7,2-!-a>;
      {font=a,12,b}<7,2 7!x7><7,2 8!x8><7,2 9!x9>{font=a,22,b}<7,2x!*a>;
      {font=a,12,b}<7,2 .!x.><7,2 0!x0>{font=a,8}
      {font=a}<7,2 Clear!clear>{font=a,22,b}<7,2/!da>;{font=a}
      <7,2 OK!OK><7,2Cancel!Cancel><7,2 Reset!reset>{font=a,22,b}<7,2=!>;
      %dlg%,<<%code%
      select
      	case left(a_dlg_button,1)="x"
      	base=base+right(a_dlg_button,1)
              case a_dlg_button="clear"
      	base = left(base,len(base)-1)
      	case a_dlg_button="Reset"
      	base=""
      	case a_dlg_button="cancel"
      	ui_modeless_dlg_close("vn")
      end select
      if right(a_dlg_button,1)="a"
      	base1=base
      	base=""
      select
          case left(a_dlg_button,1) ="+"
          vop=1
          case left(a_dlg_button,1) ="-"
          vop=2
          case left(a_dlg_button,1) ="*"
          vop=3
          case left(a_dlg_button,1) ="d"
          vop=4       
      end select
      end if
      if a_dlg_button="="
      select
          case vop=0
          base=base
          case vop=1
          base=ltrim(str(val(base)+val(base1),70,val(spin)))
          vop=0
          case vop=2
          base=ltrim(str(val(base1)-val(base),70,val(spin)))
          vop=0
          case vop=3
          base=ltrim(str(val(base)*val(base1),70,val(spin)))
          vop=0
          case vop=4
          base=ltrim(str(val(base1)/val(base),70,val(spin)))
          vop=0
      end select
      end if
      %code%)
      Last edited by G Gabriel; 05-14-2010, 08:55 PM.

      Comment


        #4
        Re: Need help on xbasic calculator

        Nice G,
        Substitute
        Code:
        4!x[COLOR="Blue"]4[/COLOR]><7,2 5!x[COLOR="Blue"]5[/COLOR]><7,2
        for the
        Code:
        4!x[SIZE=5][COLOR=Red]7[/COLOR][/SIZE]><7,2 5!x[SIZE=5][COLOR=Red]7[/COLOR][/SIZE]><7,2
        and think it is done!
        Mike
        __________________________________________
        It is only when we forget all our learning that we begin to know.
        It's not what you look at that matters, it's what you see.
        Henry David Thoreau
        __________________________________________



        Comment


          #5
          Re: Need help on xbasic calculator

          Better..
          Code:
          'Date Created: 14-May-2010 05:45:56 PM
          'Last Updated: 14-May-2010 08:14:32 PM
          'Created By  : Gabriel
          'Updated By  : Gabriel
          dim global base as C=""
          dim global base1 as C=""
          spin="2"
          dim vop as n=0
          ui_modeless_dlg_box("vn",<<%dlg%
          {xmargin=4}
          {ymargin=.1}
          {nocaption}
          {region0}
          {font=a,10,b}
          {region1}{font=a,14,b}{ypad=2}{lf=4};[.27,2 base]{endregion1}{font=a,7}|{region2}{ypad=1}{lf};{ypad=.1}Decimal;{font=a,9}[%z;s1,10%.7spin]{endregion2};
          {endregion0};
          {font=a,12,b}<7,2 1!x1><7,2 2!x2><7,2 3!x3>{font=a,22,b}<7,2+!+a>;
          {font=a,12,b}<7,2 4!x4><7,2 5!x5><7,2 6!x6>{font=a,22,b}<7,2-!-a>;
          {font=a,12,b}<7,2 7!x7><7,2 8!x8><7,2 9!x9>{font=a,22,b}<7,2x!*a>;
          {font=a,12,b}<7,2 .!x.><7,2 0!x0>{font=a,8}
          {font=a}<7,2 Clear!clear>{font=a,22,b}<7,2/!da>;{font=a}
          <7,2 OK!OK><7,2Cancel!Cancel><7,2 Reset!reset>{font=a,22,b}<7,2=!>;
           ; ;
          %dlg%,<<%code%
          select
          	case left(a_dlg_button,1)="x"
          	base=base+right(a_dlg_button,1)
              case a_dlg_button="clear"
          	base = left(base,len(base)-1)
          	case a_dlg_button="Reset"
          	base=""
          	case a_dlg_button="cancel"
          	ui_modeless_dlg_close("vn")
          end select
          if right(a_dlg_button,1)="a"
          	base1=base
          	base=""
          select
              case left(a_dlg_button,1) ="+"
              vop=1
              case left(a_dlg_button,1) ="-"
              vop=2
              case left(a_dlg_button,1) ="*"
              vop=3
              case left(a_dlg_button,1) ="d"
              vop=4       
          end select
          end if
          if a_dlg_button="="
          select
          	case vop=0
          	base=str(base,70,1)
              case vop=1
              base=ltrim(str(val(base)+val(base1),70,val(spin)))
              vop=0
              case vop=2
              base=ltrim(str(val(base1)-val(base),70,val(spin)))
              vop=0
              case vop=3
              base=ltrim(str(val(base)*val(base1),70,val(spin)))
              vop=0
              case vop=4
              base=ltrim(str(val(base1)/val(base),70,val(spin)))
              vop=0
          end select
          end if
          %code%)
          Last edited by G Gabriel; 05-15-2010, 09:59 AM.

          Comment

          Working...
          X