Some Modules

Discussion in 'Code Samples & Tips' started by klaus, Jan 13, 2009.

  1. klaus

    klaus Expert Licensed User

    Here are some general modules included in a test program.
    - Setup language choice, prompt before exit, default folder
    - FileChooser file chooser based on Erel's FolderChooser and an improvement of specci48
    - ColorPalette from the IconEdit program
    - About form
    - RPNCalc Reverse Polish Notation calculator
    - Draw Bitmap drawing program

    I added a seperate folder for each module with all files needed for it.

    Hope these could be usefull, and best regards.

    EDIT: 2009.02.04 Improved Setup and FileChooser modules.

    EDIT: 2009.03.14 Added Draw module

    Attached Files:

    Last edited: Mar 14, 2009
  2. manu

    manu Active Member Licensed User

    thanks Klaus

    very good examples, it is very difficult to absorb everything that goes in the forum every day, here is a marvel

    best regards
  3. derez

    derez Expert Licensed User

    Thanks Klaus
    I used the color selection module in my navigation program, to enable the user to select the colors of route points, lines etc.
    The integration was very easy :)

    I had a problem that forelayer erased area done with FErase command became White instead of transparent, after doing color selection. I solved it by using

    SetTransparentColor (cWhite) 
    forrm5.ForeLayer = 
    at the end of "Public Sub ReturnColorPalette(col)"
  4. klaus

    klaus Expert Licensed User

    Hi derez,

    I am glad to hear that this module is helpfull for others.

    I don't really understand the problem you had with the transparency color.

    I use transpareny in some of my programs, but I didn't need to add the two lines you mention.

    I tested it also on a second form without the need of the two lines.

    Did you declare the transparency color in AppStart before the Form.Forelayer=True and Form.Show lines?
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]App_Start[/SIZE][/FONT]
    FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff] SetTransparentColor[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] ([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]cWhite[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
    2][FONT=Courier New] frmTest.ForeLayer=[/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]True[/COLOR][/SIZE][/FONT]
    FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff] Sip[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]False[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
    2][FONT=Courier New] frmMain.Show[/FONT][/SIZE][/SIZE][/FONT]
    Best regards.
  5. derez

    derez Expert Licensed User

    Before the addition of the module I had only the Form.Forelayer=True.
    The addition of settransparency there did not change the situation - I understand that the selection of color changes the transparency color, so I had to write it again for white after the color selection.

    When I retry this again, compiling with my Laptop instead of the Desktop, the problem does not occure even without the settransparency, so there is probably some older version of something in my Desktop....

    Anyway, when I check the global definitions of the module, I see that settransparency is defined with color closer to white - RGB(250,250,250),
    Is there a reason for it ? may be this is causing the problem :confused:.
  6. klaus

    klaus Expert Licensed User

    There is an update to version 1.1 in the first post.

    Improvement of the Setup and FileChooser modules.

    Best regards.
  7. klaus

    klaus Expert Licensed User

    Hi derez,

    I still don't know why you needed to declate the transparent color again when coming back from the ColorPalette.

    Attached is a modifyed version of the TestModule program.
    There is a new button called 'Draw Test', a click on this button shows a new Form, 'frmTest' with cWhite as transparent color, declared at the beginning of the AppStart routine.
    On this form you can draw lines, point - move - release. During move a red line is drawn on the forelayer.
    From this form you can call the ColorPalette (with RGB(250,250,250) transparent color) and choose another color, and also White and it works, without setting the transparent color for the 'frmTest' form again.

    I choose the transparent color for the ColorPaltte to RGB(250,250,250) to be able to use the true white color also on the forelayer. RGB(250,250,250) looks like white but is not white.

    Best regards.

    Attached Files:

    Last edited: Feb 4, 2009
  8. snoman

    snoman Member Licensed User

    Very useful for b4p-beginners like me. My fav (because most useful 4me): the fileselect dlg

    thank u!

  9. moster67

    moster67 Expert Licensed User

    Great stuff !

    Thank you Klaus

  10. klaus

    klaus Expert Licensed User

    There is an update to version 1.2 in the first post.

    Added the Draw Bitmap drawing prgram module.

    Best regards.
  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