learning wxWidget.. Help , im totally newbie

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
laikokman
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Jan 21, 2015 7:20 pm

learning wxWidget.. Help , im totally newbie

Post by laikokman » Wed Jan 21, 2015 7:32 pm

im start with building a hello world where i learn from wxwidgets.org

after i follow all the instruction i got 1 error expected type -specifier before hello_worldApp .. how to solve this ?

and i got 1 question , i need to create a gui for CNC machine x,y,z movement ... is that possible using wxwidget ?

i got the code in c++ , can i convert this to wxwidget ? (eg: click some button can perform the movement task)

Code: Select all

#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include "iocpp.h"

typedef short _stdcall (*inpfuncPtr)(short portaddr);
typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum);

int main(void)
{

    HINSTANCE hLib;
    inpfuncPtr inp32;
    oupfuncPtr oup32;
    /* Load the library */
    hLib = LoadLibrary("inpout32.dll");
    inp32 = (inpfuncPtr) GetProcAddress(hLib, "Inp32");
    oup32 = (oupfuncPtr) GetProcAddress(hLib, "Out32");

    // BOLEH EDIT


    const int LAJU = 50;
    short x;

while (!kbhit())
    {
        x = (inp32)(0x0379);//Declaring inp32 as x
        //printf("port read %d\n",x); //x read as integer

        if (x == 127)//all low
        {
        printf("kedepan...\n");
        (oup32)(0x0378,1); //to send all low
        Delay(LAJU);
        (oup32)(0x0378,0);
        Delay(LAJU);
        }
        else if (x == 63)//pin no 10 high
        {
            printf("Stop\n");
            (oup32)(0x0378,0);
            Delay(LAJU);
            (oup32)(0x0378,0);
            Delay(LAJU);
        }
        else if (x == 255)//pin no 11 high
        {
            printf("Stop\n");
            (oup32)(0x0378,3);
            Delay(LAJU);
            (oup32)(0x0378,2);
            Delay(LAJU);
        }
        else if (x == 95)//pin no 12 high
        {
            printf("Stop\n");
            (oup32)(0x0378,0);
            Delay(LAJU);
            (oup32)(0x0378,0);
            Delay(LAJU);
        }
        else if (x == 119)//pin no 13 high
        {
            printf("Stop\n");
            (oup32)(0x0378,0);
            Delay(LAJU);
            (oup32)(0x0378,0);
            Delay(LAJU);
        }
        else if (x == 111)//pin no 15 high
        {
            printf("Stop\n");
            (oup32)(0x0378,0);
            Delay(LAJU);
            (oup32)(0x0378,0);
            Delay(LAJU);
        }

        else// other address than pin 10 , 11, 12, 13, and no 15 pin
        {
            printf("Problem with status pin.\n");// For troubleshoot the status pin
            Delay(LAJU);
        }


    }

    //TAMAT EDIT


    /* Unload the library */
    FreeLibrary(hLib);
    return 0;
Last edited by DavidHart on Wed Jan 21, 2015 8:15 pm, edited 1 time in total.
Reason: Added code-tags

User avatar
doublemax
Moderator
Moderator
Posts: 14597
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: learning wxWidget.. Help , im totally newbie

Post by doublemax » Wed Jan 21, 2015 9:36 pm

Starting a new "hello world" from scratch is not that easy. After you pick your compiler/IDE i highly recommend to start by building the "minimal" sample that comes with wxWidgets. Once that builds and works, you've mastered the hardest part.

For a quick start, take an already present event handler from the minimal sample, MyFrame::OnAbout() in minimal.cpp. This is called when you select "About" from the help menu. Paste your own code there. If that works, you can start building your own GUI.
Use the source, Luke!

Post Reply