Welcome! Log In Create A New Profile

Advanced

Adding Control via code

Posted by Willy 
Adding Control via code
July 03, 2023 03:41PM
I have to expand my POS system for restaurant and inn.

For that I have to make a graphic table plan.

The user must click on the touch screen on a table to select it.

The tables are of course in a different place at the different customers.

Customers often have an interior space and a terrace.

I already have several images of tables ready.

How can I get it at the correct position of a screen after one -off configuration of one customer.

So I'm looking for something like
AddControl ("Clickimage", "Path", X, Y, Width, Height, "FuncTableClick")
nSelectedTable = FuncTableClick ()


Is this possible in WinDev.

Thanks a lot.

Willy.
Re: Adding Control via code
July 03, 2023 04:08PM
I have asked it also on chatgpt.

This is the result.

PROCEDURE CreateButtons()
    FOR i = 1 TO 24
        // Maak een nieuwe knop aan
        BUTTON btnButton
        
        // Geef de knop een naam en positie
        btnButton.Caption = "Button " + i
        btnButton.X = 50 + (i-1) * 100
        btnButton.Y = 50
        
        // Wijs een actie toe aan de knop
        btnButton.Click = PROCEDURE
            // Voer hier de actie uit die je wilt dat de knop uitvoert
        END
        
        // Voeg de knop toe aan het venster
        ADD(btnButton)
    END
END
pao
Re: Adding Control via code
July 03, 2023 05:40PM
I never done it with Clickimage but i do lot of control duplications for table columns, input controls, ...

From my experience it's easier to crete one control with the default values, properties,... and use CONTROLCLONE instead.

Regards

Paulo Oliveira
Re: Adding Control via code
July 04, 2023 01:16PM
Hi Willy,

If you have WX v27 (or newer), then you could use the diagram control, instead of creating/cloning controls.
[help.windev.com]
It is what I am currently using - in my soon-to-be-available - alpha360 hospitality module, and it does what you want automatically ...

If you have a WX version prior to v26, you could also use a lopper.
But if you want to go "with the clone path" you should probably use ControlInfoXY - but it is not an easy task.

Regards
Steven Sitas
www.alpha360.biz
Re: Adding Control via code
July 05, 2023 05:47PM
Hi. You can also utilize an Image control, and clone as you need.
I did it once for a interactive floorplanner.
All images where loaded and correctly positioned at open.
Then you could move images with mouse, or clic on then to make actions.
I didn't try with the diagram control, since I did that project about 10 years ago.
Re: Adding Control via code
July 07, 2023 10:07AM
I've used an extra invissible plane with models.
Then I used control clone.

It works fine.

Thanks to you all.

Greetings
Willy.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: