Results To Other Module

Discussion in 'Questions (Windows Mobile)' started by ceaser, May 27, 2009.

  1. ceaser

    ceaser Active Member Licensed User

    Hi

    I need help.:sign0085:

    My surveying program consists of a couple of modules. When I am in one of the modules (say COGO calcs) and a textbox has the focus where I need to enter some data in. But before I can do that, I first need to calculate the info which needs to be entered in the Textbox, which I do with the "Calculator" which sits in another module.

    Now my question. Can I send the results straight from the "Calculator" module to the other module in the textbox which had the focus?:confused::confused:

    I am attaching my "Calculator" module. There I have a button which has ">>" on it. The idea is that once I have done my calculations and I press the ">>" button, then the "Calculator" module should unload and the results be displayed in the textbox which had the focus before I loaded the "Calculator" module.:BangHead:

    Thanks
    Michael
     
  2. agraham

    agraham Expert Licensed User

    I think that you may have the wrong idea about what modules are. They don't "load" and "unload" thay are merely a way of partitioning your source code into functional parts and are all compiled together into the final exe. Using modules doesn't alter the structure of the code from if you had everything in the main module. It just lets you hide private clutter and just make public the Subs and Globals you want to use in other parts of your program by prefixing them with the module name.

    Having called your calculator code from your code you need to save the result in some Globals or a file or stick them in a textbox or a table or whatever you want so you can access them later from some code that knows what to do with it. Just like you would have done without modules.
     
  3. ceaser

    ceaser Active Member Licensed User

    Hi Agraham

    Thanks for your reply.

    I know what modules are all about and how they work. It is just that I got my sentences mixed up. It is sometimes difficult to think in german and write in another language!:sign0148::BangHead:

    I am not really sure that you understand what I want to do. I am busy with a "Polar" calculation, but for the angle input textbox, I need to add 2 angles. Now,.....the angle input textbox has the focus and I click on the "Calculator" icon to add the 2 angles. Then I click on ">>" on my calculator; the calculator closes (hides....or whatever you want to call it!:) and hey presto the answer sits in the input textbox that had the focus. This way I don't have to write the answer on my hand in the field. If I carry on like this I will get blood poisening!:sign0161:

    While I have your attention. May I send through my (yours:sign0188: ) delauney module. I need to me able to delete triangles and also add "Manually" triangles by tapping on points on the screen. You will also see that I have a "Shading" routine. But it does not work very good. Maybe you can give me some ideas.

    And lastly. I am nearly finished with my CAD module. Works very much like Autocad Lite. If I send it through could you have a look to put it in a DLL?

    Thanks
    Michael (alias Ceaser)
     
  4. klaus

    klaus Expert Licensed User

    Hi Michael,

    As a workaround for your calculator you could:
    - add a same ContextMenu to your TextBoxes that calls the calculator
    - in the contextmenu you can get, with the Door library, the calling TextBox name and transfer it to the calculator
    - in the calculator, in the SendResults_Click routine, you can set the result in the right TextBox.

    Attached a sample program with a main module with a window with 3 TextBoxes, the ContextMenu and your Calc module a little bit modified.
    I changed the form name from Calc to frmCalc, because having the same name for the module and for the form provided some trouble for calling the calculator.
    I also changed the module name to avoid any mix up with yours. To replace your module with mine, in your program, just change it's name back to 'Calc'.

    Hope this would help you.

    Best regards.
     
  5. Zenerdiode

    Zenerdiode Active Member Licensed User

    I wonder if you may get any ideas from this? Here is my test code for calling up a keypad in the device. Instead of using focus events of a textbox, I've made buttons that look like text boxes. When finished entering the desired value, the calling button's .text value is set. You may then evaluate this elswhere in your code.

    I appreciate you will have to add your calculator code to the keypad sub - it is just an idea for you. :)
     

    Attached Files:

  6. agraham

    agraham Expert Licensed User

    I'm not sure what you mean by "send through" but yes.

    No promises but I'll take a look, though the only reason to dll it would be for maths performance - is that why you want a dll?
     
  7. ceaser

    ceaser Active Member Licensed User

    Hi Agraham:sign0188:

    What I mean by "send through" is to post the module on the forum. Sorry for my English!!:sign0137:

    You are right, the only reason for the DLL is for maths involved in the CAD module.

    Coming back to your Delauney routine. I have a routine called "Shading", which shades the triangles according to the average heights of the three vertices of each triangle. Now if you only one triangle then one sits with only one color. Is there not a faster way of shading the triangles according to the gradient of each side of the triangles? So if one has only one triangle the one side would start off with say a blue color and as it progresses up to the higher vertice point, it slowing changes to a more lighter color.:sign0085:

    I hope you can help me.

    Regards
    Michael

    PS. I hope my English is OK:sign0148:
     
  8. agraham

    agraham Expert Licensed User

    Faster than what? How are you shading the triangles at the moment? What you seem to want is a gradient fill of a triangle. At the moment I know of no way of doing this in .NET.Basic4ppc. It might be possible by making a native call as ImageLibEx does to gradient fill a rectangle but I have never actually tried it.
    If you post some code for me to play with and an explanation of what you want I will see.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice